ubuntu使用mailx发送邮件

关闭sendmail或者postfix

service sendmail stop 

service postfix stop


1、安装heirloom-mailx

apt install heirloom-mailx


2、配置外部SMTP

我的ECS是Ubuntu16.04 ,配置文件为/etc/s-nail.rc,把下面几行放置在最后

如果不配置端口发送可以使用


[html] view plain copy

  1. set from=xxx@163.com  
  2. set smtp=smtp.163.com  
  3. set smtp-auth-user=xxx@163.com  
  4. set smtp-auth-password=123456  
  5. set smtp-auth=login  


如果配置端口则


[html] view plain copy

  1. set from="xxx@163.com"  
  2. set smtp="smtps://smtp.163.com:465"  
  3. set smtp-auth-user="xxxm@163.com"  
  4. set smtp-auth-password="123456"  
  5. set smtp-auth=login  


或者


[html] view plain copy

  1. set from="xxx@163.com"  
  2. set smtp="smtps://smtp.163.com:465"  
  3. set smtp-auth-user="xxxm@163.com"  
  4. set smtp-auth-password="123456"  
  5. set smtp-auth=login  




注:以上三种配置都可以尝试



3、发送

echo 'this is test' | mail -s "test email." 123@qq.com


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值