天天看點

CentOS6.5下調用外部郵箱發送郵件1、配置/etc/mail.rc,使用mail指令2、msmtp+mutt方式

以下是自己收集的實用Linux下簡單配置外部郵箱發送郵件的方法:

# vim /etc/mail.rc

###調用外部郵箱   

set smtp=smtp.exmail.qq.com  

set [email protected]     

set smtp-auth-password="XXXXXX"

set smtp-auth=login

然後使用mail指令即可發送郵件了

# xz -d msmtp-1.6.5.tar.xz

# tar xvf msmtp-1.6.5.tar

# cd msmtp-1.6.5

# ./configure --prefix=/usr/local/msmtp

# make && make install

# vim ~/.msmtprc                                       

account default     

host smtp.exmail.qq.com     

password XXXXXX

auth login   

logfile ~/.msmtp.log

# yum install mutt -y

# vim /etc/Muttrc

set sendmail="/usr/local/msmtp/bin/msmtp"   

set use_from=yes     

set realname="XXXXXX"     

set editor="vim"

echo "Email" |mutt -s"test" [email protected]

msmtp: envelope from address root@ not accepted by the server

msmtp: server message: 501 mail from address must be same as authorization user

msmtp: could not send mail (account default from /usr/local/msmtp/etc/msmtprc)

Error sending message, child exited 65 (Data format error.).

Could not send the message.

修改/etc/Muttrc:

set sendmail="/usr/local/msmtp/bin/msmtp"

set use_from=yes

set envelope_from="yes"

本文轉自 ygqygq2 51CTO部落格,原文連結:http://blog.51cto.com/ygqygq2/1828116,如需轉載請自行聯系原作者