[BL] Fwd: sending mail via telnet

David Moberg davidjmoberg at gmail.com
Sat Dec 2 22:42:45 EST 2006


The following message was sent by Lee Forrest. I am forwarding it to
the list because the listserver is rejecting all posts by him. (Note
the To: line below)

---------- Forwarded message ----------
From: Lee Forrest <lforrestster at gmail.com>
Date: Dec 2, 2006 3:44 PM
Subject: Re: sending mail via telnet
To: baslinux at lists.ibiblio.org
Cc: davidjmoberg at gmail.com


On Sat, Dec 02, 2006 at 02:37:46PM +0000, sindi keesan wrote:

[delete]

> >For scripting, netcat is _much_ better than telnet. I have a toy
> >bash script that sends mail to a mailserver with netcat.
>
> Would you like to share this info with the list and also send a copy to
> David, and if it does not arrive he can forward it?  BL has netcat.  I
> think we use it to send files over serial or ethernet cable between
> computers, with a bash script that Steven wrote (send/receive).

##!/bin/bash
#
## this works - need to get DATA part in a file
## to read in.
#
#log=/dev/tty
#smtp_server=smtp.foo.net
#mkfifo /tmp/$$.out
#hostname=localhost
#
#function read_response () {
#  local status=""
#  while [ -z "$status" ] ; do
#    read line < /tmp/$$.out
#    case "$line" in
#    [0-9]??' '*) status="$(echo "$line" | sed -e 's/^\(.\).*/\1/')" ;;
#    [0-9]???*) true ;;
#    *) echo QUIT ; sleep 3 ; exit 1 ;;
#    esac
#  done
#  echo "$status"
#}
#
#
#(
#    if [ $(read_response) != "2" ] ; then echo QUIT ; sleep 3 ; exit 1 ; fi
#    echo "HELO $hostname"
#    if [ $(read_response) != "2" ] ; then echo QUIT ; sleep 3 ; exit 1 ; fi
#    echo "MAIL FROM: abc at def.ghi"
#    if [ $(read_response) != "2" ] ; then echo QUIT ; sleep 3 ; exit 1 ; fi
#    echo "RCPT TO: alanconnor at earthlink.net"
#    if [ $(read_response) != "2" ] ; then echo QUIT ; sleep 3 ; exit 1 ; fi
#    echo "DATA"
#    if [ $(read_response) != "3" ] ; then echo QUIT ; sleep 3 ; exit 1 ; fi
#    echo "Subject: FOOBAR"
#    echo ""
#    echo "KKKKKKKKKKKKKK"
#    echo ""
#    echo "."
#    if [ $(read_response) != "2" ] ; then echo "QUIT"
#    echo "Delivery Failed" > $log;  sleep 3 ; exit 1 ; fi
#)| netcat $smtp_server 25 > /tmp/$$.out
#exit 0

[delete]

Lee



More information about the BasLinux mailing list