現象一:發送郵件執行時報錯服務器
root@/usr/bin# echo "hello this echo print"|mutt -s"linkmail"coobutter@live.comapp
Error sending message, child exited 127 (Exec error.).測試
Could not send the message.this
先單獨使用msmtp發送測試:msmtp -S 發現是配置文件沒找到spa
msmtp: account default not found: no configuration file available.net
查看當前的配置文件路徑:msmtp -Pserver
ignoring system configuration file/work/target/etc/msmtprc: No such file or directoryblog
ignoring user configuration file /root/.msmtprc: No such file ordirectoryssl
falling back to default accountget
msmtp: account default not found: no configuration file available
故將/usr/local/etc/Muttrc 複製爲/root/.muttrc
將/usr/local/etc/msmtprc 複製爲/root/.msmtprc
便可。
現象二:發送郵件服務器退回郵件(郵件服務器認爲發送的是垃圾郵件)
msmtp: the server did not accept the mail
msmtp: server message: 543 reject byentas5-smtp(ID:1361427919.643)(time:Thu Feb 21 14:25:29 2013)
msmtp: could not send mail (account default from/usr/local/etc/msmtprc)
由於沒有填寫from和to段。
此外若是是經過smtp.163.com發送的話,也必需要填寫from和to段,不然,163將認爲其是垃圾文件,拒絕轉發。
host smtp.163.com
port 25
from coobutter@163.com
auth login
tls off
user coobutter@163.com
password ***** #密碼
logfile /var/log/msmtp.log