ubuntu18.04 heirloom-mailx 通過外部SMTP服務器發送郵件


配置軟件源
ubuntu18.04上無法直接安裝heirloom-mailx,需要添加軟件源

sudo vi /etc/apt/sources.list
寫入

deb http://cz.archive.ubuntu.com/ubuntu xenial main universe
 
安裝heirloom-mailx
sudo apt-get update
sudo apt install heirloom-mailx
 
配置外部SMTP
Ubuntu18.04的配置文件為/etc/s-nail.rc,把下面幾行放置在最后

set from="123456789@qq.com"
set smtp="smtps://smtp.qq.com:465"
set smtp-auth-user="123456789@qq.com"
set smtp-auth-password="ahkphxxabcbshabbga"
set smtp-auth=login
注意:1.第四行password是指的QQ郵箱授權碼,不是密碼,QQ郵箱授權碼獲取可以查看相關文章:https://jingyan.baidu.com/article/fedf0737af2b4035ac8977ea.html

   2.from 和 smtp-auth-user郵箱要一致

測試
echo "郵件內容" | s-nail -s "郵件主題" xxx456@qq.com
或者

s-nail -s "郵件主題" 123xxx@qq.com < result.txt

原文鏈接:https://blog.csdn.net/mdx20072419/article/details/103901254


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM