安裝mailx:
(1) wget http://ftp.debian.org/debian/pool/main/h/heirloom-mailx/heirloom-mailx_12.5.orig.tar.gz
(2) tar zxvf heirloom-mailx_12.5.orig.tar.gz
(3) cd heirloom-mailx-12.5/
(4) make && make install UCBINSTALL=/usr/bin/install
修改 /etc/nail.rc 文件在文件的最後添加
set [email protected]
set smtp=smtp.exmail.xx.com
set [email protected] #與郵箱名一致
set smtp-auth-password=passwd #郵箱密碼或者是動態授權碼
set smtp-auth=login # SMTP授權的一般都是LOGIN
測試發送郵件:
(1) 內容 + 主題
echo 內容 | mailx -v -s "郵件標題" [email protected] 例: echo hello word | mailx -v -s "demo title" [email protected]
(2)主題 + 文件中的內容 將文件中的內容作爲郵件內容發送到對應的郵箱中
cat content.txt | mailx -v -s ‘hello’ [email protected]
常見問題與解決方法:
(1)