Sent mail -Shell:Mark 一下。
2013-11-15 10:59
399 查看
shell发送邮件(smtp)
#!/bin/sh# shell_mailer.sh, Shell Mailer, (MTA)
# #---------------------
# # Variables
# #---------------------
sender=$1 # 发信人的email
reciver=$2 # 收信人的email
subject=$3 # 邮件的标题
email_content_txt=$4 # 存放邮件内容的文件
smtp='mail.163.com' # 修改这里,邮件服务器地址
if [ "$#" != 4 ]; then
echo "Usage: $0 mailsender@doamin.commailrecieve@domain.comsubject text_file"
exit 2
fi
# text_file的内容为邮件正文
mesge(){
cat << EOF
From: <$sender>
To: <$reciver>
Subject: $subject
Date: `date` +0800
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
X-Mailer: Solaris Mail Client
X-MimeOLE: Powered by Solaris
# # 邮件使用了ASCII编码,而非BASE64,这可以保证存储邮件正文的文件中直接使用常见的ASCII明文进行编辑
#
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
Reference :http://hi.baidu.com/h_weboo/item/090115d43e6ffa1620e25034
位置參數:/article/10440846.html
shell 變量:http://blog.csdn.net/u010300484/article/details/8818055
相关文章推荐
- 第一次,Mark一下
- redux实战参考(RN),mark一下
- Mark一下
- 第一次工作,终于完成了一个段落,mark一下
- 大致看了下,很给了,mark一下。 http://cn.vuejs.org/
- DP模型状态转移方程(mark一下,有天我也要自己总结)
- 别人那搞过来date工具mark一下
- Mark一下
- 好久没弄导入.xls文件处理了,mark一下
- 今天开始学习wince6.0 ,mark一下,用的6410 wince6.0平台
- ZeroMQ(Java)使用个人小心得,这里Mark一下(适用于windows64bit及32bit)
- 小小mark一下scrollView,然而用途绝不限于此
- 新公司上班Mark一下
- Runtime运行时(mark一下)
- MARK一下,nodejs 使用session
- Mark 一下~~~
- mark一下总是记混的重定向与转发的区别
- 上个礼拜五收到mail,通过PMP了,自己庆祝一下
- phoenixframework集成了所有自动化测试的思想的平台。mark一下。
- 【mark】第一次打卡,mark一下进度