1、关闭本机的sendmail服务或者postfix服务
#执行下面的命令,各位大侠都对号入座吧
#sendmial
service sendmail stop
chkconfig sendmail off
#postfix
service postfix stop
chkconfig postfix off
#再狠一点就直接卸载吧..
yum remove sendmail
yum remove postfix
 
2、然后修改/etc/mail.rc,在文件末尾增加以下内容,指定邮箱和授权码
set from=123456@qq.com
set smtp=smtp.qq.com  
set smtp-auth-user=123456
set smtp-auth-password=你的授权码
set smtp-auth=login  
 
3、授权码的获取方式
4、然后通过命令来发送邮件
echo  hello word | mail -s " title" 123456@qq.com  
 
如果希望带html格式的内容,可以这么发:
echo "HTML Message goes here" | mail -s "$(echo -e "This is the subject\nContent-Type: text/html")"  123456@qq.com
 
参考文献: