ubuntu是哟mailx发送邮件

搭建邮件发送这么简单的一个功能,我在阿里云ECS上来回倒腾了几天,并且先后使用sendmail、postfix、heirloom-mailx等多种发送邮件的软件。但总是出现各种各样的错误。查找了百度和谷歌以及阿里云开放论坛,终于搞定了,网上的资料好分散,查来查去都是相同内容,索引我把我搭建的经过写出来,希望以后别有人掉坑里了

下面我直接描述邮件发送成功的经过:

1、安装heirloom-mailx

apt install heirloom-mailx

2、配置外部SMTP

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

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

set [email protected]
set smtp=smtp.163.com
set [email protected]
set smtp-auth-password=123456
set smtp-auth=login

如果配置端口则
set from="[email protected]"
set smtp="smtps://smtp.163.com:465"
set smtp-auth-user="[email protected]"
set smtp-auth-password="123456"
set smtp-auth=login

或者
set from="[email protected]"
set smtp="smtps://smtp.163.com:465"
set smtp-auth-user="[email protected]"
set smtp-auth-password="123456"
set smtp-auth=login

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


3、发送

echo 'this is test' | mail -s "test email." [email protected]

原文:https://blog.csdn.net/just_shunjian/article/details/78677054

猜你喜欢

转载自www.cnblogs.com/paad/p/10716060.html
今日推荐