Wednesday, February 15, 2012

Script to send Email through Linux

#!/bin/ksh
# script to send simple email
# email subject
SUBJECT="SUBJECT FOR EMAIL"
# Email To ?
EMAIL="abcd@xyz.com"
# Email text/message
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "This is an email message test"> $EMAILMESSAGE
echo "This is email text" >>$EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

No comments:

Post a Comment