# Description: # This script attempts to send an email using 'netcat' to the yahoo account # matth3wbishop@yahoo.com. This is to be used in circumstances in which using a # normal mail server is not possible. # # It has the disadvantage that a delay interval for 'netcat' is necessary. # This means that the script will take quite some time to return, which # may be unacceptable from a web-page for example. One solution is to # run the script in the background with &, but thats a bit dodge. # # The better solutions are to write or find a Java SMTP mail sender or # to set up a 'sendmail' program on the local server. # # Notes: # The script can only send mail to the 'localhost' because it does # no SMTP authorization, and therefore it can only send mail to somebody # who has a mail box on the local computer. if [ "$1" != "" ] then sMessage=$1 else echo "usage: $0 messageBody [mailSender] [mailsubject]" cat $0 | sed -n "/^[ ]*#/p" exit 1; fi if [ "$2" != "" ] then sMailSender=$2 else sMailSender="unknown@nowhere" fi if [ "$3" != "" ] then sMailSubject=$3 else sMailSubject="none" fi #-- Instead of echoing all of the following text into netcat #-- I am going to try to use the -e switch to netcat with this script name #-- Otherwise the delay of 1 second between each output line causes the email #-- to take to long to send (one second for each line of the email plus headers). echo "HELO ella-associates.org"; echo "MAIL FROM:<$sMailSender>"; echo "RCPT TO:"; echo "DATA"; sleep 1; echo "subject: $sMailSubject "; echo "from: <$sMailSender> "; echo "to: "; echo "date: $date "; echo "content-type: text/html;" echo " "; echo $sMessage; #sleep 1; printf "\r\n.\r\n"; echo "quit" #| netcat -v -v -i1 localhost 25