Linux中的邮件发送

本文介绍了两种常见的邮件发送方法:使用mail命令和Mutt工具。详细解释了如何配置sendmail及postfix服务,以及如何通过命令行发送纯文本邮件和带附件的邮件。

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值