第一步:下載解壓包
wget http://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_12.5.orig.tar.gz
第二步:解壓縮
tar zxvf heirloom-mailx_12.5.orig.tar.gz
第三步:跳轉到解壓縮目錄下
第四步:編譯安裝
make && make install UCBINSTALL=/usr/bin/install
第五步:編輯配置文件
vi /etc/mail.rc
第六步:配置發送郵件信息
vi /etc/mail.rc
在配置文件的最後添加如下代碼:
# 配置發送郵件的信息
set [email protected] #(需修改)和第三行郵箱地址保持一致
set smtp="smtp.qq.com" #(需修改)所使用的外部郵箱的smtp服務器地址
set smtp-auth-user="[email protected]" #(需修改)所使用的外部郵箱的用戶名
set smtp-auth-password="admin" #(需修改)授權碼
set smtp-auth="login"
遇到問題:
發送郵件遇到問題
send-mail: fatal: parameter inet_interfaces: no local interface found for ::1
解決:
vi /etc/postfix/main.cf
如果是要在阿里雲的遠程服務器上發送郵件,上面的配置就不能成功,因爲25端口不能使用。所以需要藉助其他手段:https://blog.csdn.net/qq_42859864/article/details/84862977
可以輸入命令進行測試:
echo "test" | mail -s "test" [email protected] #這裏填寫收件人的郵箱
發送成功就可以在郵箱看到成功的郵件,否則沒有成功。
關於mial的操作可以參考:https://www.cnblogs.com/xiangsikai/p/8441195.html