ubuntu中怎么配置外部smpt發送郵箱
添加heirloom-mailx apt源
cat /etc/apt/sources.list.d/mailx.list
deb http://cz.archive.ubuntu.com/ubuntu xenial main universe專注于為中小企業提供成都做網站、成都網站建設、成都外貿網站建設服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業善左免費做網站提供優質的服務。我們立足成都,凝聚了一批互聯網行業人才,有力地推動了成百上千企業的穩健成長,幫助中小企業通過網站建設實現規模擴充和轉變。
更新apt
apt update安裝heirloom-mailx
apt install heirloom-mailx -y配置外部發件郵箱
編輯 /etc/s-nail.rc在最后加上:for 163郵箱
set from="xxxxx@163.com" #發件地址
set smtp="smtps://smtp.163.com:465" #smtp服務器
set smtp-auth-user="xxxxxx@163.com" #登錄發件地址
set smtp-auth-password="xxxx" #明文密碼
set smtp-auth=login #登錄方式,默認是login,也可以改成CRAM-MD5或PLAIN方式for outlook
set from="xxxx@outlook.com"
set smtp="outlook.office365.com:587"
set smtp-auth-user="xxxx@outlook.com"
set smtp-auth-password="xxxx" #明文密碼
set smtp-use-starttls #加密方式
set ssl-verify=ignore # 忽略ssl認證
set smtp-auth=loginfor QQ mail
set from="xxx@qq.com"
set smtp="smtps://smtp.qq.com:465"
set smtp-auth-user="xxx@qq.com"
set smtp-auth-password="ahkphxxabcbshabbga" #QQ郵箱授權碼
set smtp-auth=login- 常用命令
常用命令:
n:不讀入設置文件(本系統中是/etc/s-nail.rc)(這個文件允許用戶使用外部郵件傳輸代理而不是使用系統自帶的sendmail發送郵件)。
s:設置郵件的主題信息。
c:使用一個抄送列表。
b:使用一個密送列表。 - 發送測試郵件
echo "內容"|s-nail -s "主題" xxxx@163.com,xxxx@outlook.com #多個郵箱用逗號隔開
或者:
s-nail -s "郵件主題" xxx@163.com < result.txt
加參數v可以看到mail輸出的詳細信息
s-nail -vs "郵件主題" xxx@163.com < result.txt - 發送帶附件
s-nail -a 附件 -s "主題" 收件地址 < 文件(郵件正文.txt)
s-nail -a /xxx.tar.gz -s "主題" xxx@163.com < ./xxx.txt - shell 當編輯器,編輯完內容后按Ctrl-D結束
s-nail -s '主題‘ xxx@163.com
網站欄目:ubuntu中怎么配置外部smpt發送郵箱
文章URL:http://www.xueling.net.cn/article/gehhpd.html