Loading

Linux中的邮件发送

    这里写出两种常用的邮件发送方式:

mail:

需要安装sendmail和postfix两个服务

编辑/etc/mail.rc,在最后添加

 

set from=scottcho@126.com smtp=smtp.126.com
set smtp-auth-user=scottcho  smtp-auth-password=xxxx
set smtp-auth=login

 

  

 

 

  没有附件的邮件:

    echo "hello"|mail -s "test mail" scottcho@qq.com

        或者

    mail -s "测试" scottcho.qq.com <new.txt

  发送带有附件的邮件:

    mail -s '测试' -a applicationContext-mail.xml scottcho.qq.com < new.txt

需要注意的是服务器的hostname应该为xxx.xxx的形式,不然会QQ和163等一些邮箱拦截

 

Mutt:

  mutt -s "test mail" scottcho@qq.com -a /etc/hosts <new.txt

posted @ 2017-01-13 17:30  头痛不头痛  阅读(234)  评论(0编辑  收藏  举报