搭建邮件发送这么简单的一个功能,我在阿里云ECS上来回倒腾了几天,并且先后使用sendmail、postfix、heirloom-mailx等多种发送邮件的软件。但总是出现各种各样的错误。查找了百度和谷歌以及阿里云开放论坛,终于搞定了,网上的资料好分散,查来查去都是相同内容,索引我把我搭建的经过写出来,希望以后别有人掉坑里了
下面我直接描述邮件发送成功的经过:
1、安装heirloom-mailx
apt install heirloom-mailx
2、配置外部SMTP
我的ECS是Ubuntu16.04 ,配置文件为/etc/s-nail.rc,把下面几行放置在最后
如果不配置端口发送可以使用
set from=xxx@163.com
set smtp=smtp.163.com
set smtp-auth-user=xxx@163.com
set smtp-auth-password=123456
set smtp-auth=login
如果配置端口则
set from="xxx@163.com"
set smtp="smtps://smtp.163.com:465"
set smtp-auth-user="xxxm@163.com"
set smtp-auth-password="123456"
set smtp-auth=login
</