ubuntu 20.04 发邮件配置


安装sendmail后,发邮件一直没有成功,因此卸载sendmail后,安装heirloom-mailx。

# unbuntu 18.04和20.04移除了heirloom-mailx,需要另外配置软件源
vim /etc/apt/sources.list

# 加入
deb http://cz.archive.ubuntu.com/ubuntu xenial main universe

# 安装heirloom-mailx
apt-get update
apt-get install -y heirloom-mailx
apt-get install -y mailutils

# 安装mailutils时,会弹出图形化安装界面,选择Internet Site,System mail name 的值应该和ubuntu中hostname保持一致,如karl

# hostnamectl set-hostname karl
# 配置外部SMTP

 

配置外部SMTP,将如下几行加入/etc/s-nail.rc文件最后面

set from="1106438132@qq.com"
set smtp="smtps://smtp.qq.com:465"
set smtp-auth-user="1106438132@qq.com"
set smtp-auth-password="cgnbhnhftaenhdaj"
set smtp-auth=login

# auth-password是邮箱授权码,不是邮箱密码,需登录邮箱后查看

 

# 测试邮件发送
echo "test_context" |s-nail -s "test_sub" karlkiller@icloud.com

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM