sudo apt-get install sendemail -y
#注意是sendemail 不是sendmail

/usr/bin/printf "***** test1 *****\n Type" | /usr/bin/sendemail -t **@163.com -f **@163.com  -s smtp.163.com  -xu **@163.com -xp ** -u "Sendemail"


参数解释:
#sendemail -f nagiosdemo@163.com -t nagiosdemo@163.com -s smtp.163.com -u “from nagios” -xu nagiosdemo -xp nagiosdemo -m happy
#/usr/bin/printf "***** test1 *****\n Type" | /usr/bin/sendemail -t **@163.com -f **@163.com  -s smtp.163.com  -xu **@163.com -xp ** -u "Sendemail"

-f 表示发送者的邮箱
-t 表示接收者的邮箱
-s 表示SMTP服务器的域名或者ip
-u 表示邮件的主题
-xu  表示SMTP验证的用户名
-xp  表示SMTP验证的密码(注意:这个密码有限制,一些特殊符号或者超长度密码不能被正确识别)
-m 表示邮件的内容
-v  显示详细信息,同DEBUG
-o message-content-type=html   邮件内容的格式,html表示它是html格式
-o message-charset=utf8        邮件内容编码</pre>
-a /data/site/a.rar             发送ttlsa.rar这个文件