#! /bin/bashTo use this script, like any other, don't forget to first make it executable. Assuming that you have saved the script as 'sendit.sh'
#
# =======================
# Send Mail Script 0.1
# Written by VPSDiary
# http://vpsdiari.blogspot.com
# You may use, modify, and redistribute this script freely
# Released: June 2010
# =======================
function make_email
{
cat <<- _EOF_ Hi, The Body of your email comes here. Add whatever you want, including $variables _EOF_ }
#Input the SUBJECT
echo -n "What is the subject?" read SUBJECT echo "==> Email to whom? "
read EMAIL
# Make email body's text
touch /tmp/message.txt
make_email > /tmp/message.txt
# send email
mail -s "$SUBJECT" "$EMAIL" < /tmp/message.txt
#Say that it is sent echo "email sent to $EMAIL" echo "********"
chmod +x sendit.shAnd to use it:
bash sendit.shor
./sendit.sh
Don't use it to spam people! :)
No comments:
Post a Comment