BASH email test script

#!/bin/bash
# script to send simple email

# Email To ?
echo “Enter Mail To”
read EMAIL

# Email text/message
EMAILMESSAGE=”/tmp/emailmessage.txt”
echo “This is an email message test”>>$EMAILMESSAGE
echo | date >> $EMAILMESSAGE
echo “Test”>>$EMAILMESSAGE
echo “Test”>>$EMAILMESSAGE

nail -v -r “support@mydomain.com” -s “Test Email” -S smtp=mysmtpserver $EMAIL < $EMAILMESSAGE

#Clean up
rm /tmp/emailmessage.txt

You can leave a response, or trackback from your own site.

Leave a Reply