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