Send Email
The purpose of this document is to describe how to send email from the command line.
Very simple:
mailx -s "Test message from justin" test@aws02.jgspratt.com < /root/email_test.txt
Send 2000 in a loop:
for i in {1..2000}; do sendmail test@aws02.jgspratt.com < /root/email_test.txt; echo "send $i emails."; sleep 1; echo -n "."; sleep 1; echo -n "."; sleep 1; echo "."; sleep 1; done
Pipe text to mail:
echo "${thishostname}.jgs.im: ${harvestdir} has ${numfiles} .zip files as of ${isodate}" | mail -s "Harvester warning: ${this_hostname}" "developers@jgspratt.com"`
Send with an attachment (/foo/bar):
echo "Message content" | mailx -s "Subject of message with attachment" -a /foo/bar justin@jgspratt.com