日期:2014-05-16 浏览次数:20951 次
#!/bin/sh
# shell_mailer.sh, Shell Mailer, (MTA)
# #---------------------
# # Variables
# #---------------------
mailfile=test.txt
sender=aaa@bbb
reciver=aaa@bbb
email_content_txt=$mailfile
smtp='mail.bbb'
subject='test'
#if [ "$#" != 4 ]; then
#echo "Usage: $0 mailsender@doamin.com mailrecieve@domain.com subject text_file"
#exit 2
#fi
mesge(){
cat << EOF
From: <$sender>
To: <$reciver>
Subject: $subject
Date: `date` +0800
Mime-Version: 1.0
ontent-Type: text/plain; charset="us-ascii"; format=flowed
X-Mailer: Solaris Mail Client
X-MimeOLE: Powered by Solaris
EOF
test -r $email_content_txt && cat $email_content_txt
}
send_mail(){
(
sleep 5
for comm in "helo 163.com" "mail from:<$sender>" "rcpt to:<$reciver>" "data"
do
echo "$comm"
sleep 3
done
#mesge
sleep 3
echo ".")| telnet $smtp 25
}
send_mail