天天看点

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,如需转载请自行联系原作者