yum -y install sendmail

vim /etc/mail.rc 

set from=xxxxx@qq.com smtp=xxx.qq.com

set smtp-auth-user=xxx smtp-auth-password=xxx smtp-auth=login  

这是两行不能分开写,

set from 由谁发

smtp 发送的smtp服务器

set smtp-auth-user 登陆的用户名

smtp-auth-password 登陆的密码

smtp-auth           登陆的方式

 

# /etc/init.d/postfix stop ; chkconfig postfix on

# /etc/init.d/sendmail restart  ; chkconfig sendmail on

# echo  "主题" | mail -s "内容" xxxx@qq.com