十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
系统运维
Linux下使用mutt发送邮件
1、root用户执行
sudo apt-get install msmtp
sudo yum -y install msmtp
sudo yum -y install mutt
wget http://downloads.sourceforge.net/msmtp/msmtp-1.4.30.tar.bz2?big_mirror=0
tar -jxvf msmtp-1.4.30.tar.bz2
cd msmtp-1.4.30
./configure --prefix=/usr/local/msmtp
make
make install
chmod -R 755 /usr/local/msmtp
ln -s /usr/local/msmtp/bin/msmtp /usr/bin/msmtp
[xxxxxxx@vmcxapk01 ~]$ cat .msmtprc
account default
host smtp.richinfo.cn
port 25
from xxxxxxx@richinfo.cn
auth login
tls off
user xxxxxxx@richinfo.cn
password #@######
logfile ~/.msmtp.log
vi ~/.muttrc
set sendmail="/usr/bin/msmtp" msmtp #安装位置,提前做了软连接 (可以使用which msmtp获取)
set use_from=yes
set realname="XX" 发信人名称
set from="XX" 发信人邮箱账号
set envelope_from=yes
set editor="vim -nw"
[xxxxxxx@vmcxapk01 ~]$ cat .muttrc
set sendmail="/usr/bin/msmtp"
set charset="UTF-8" #设置好编码
set rfc2047_parameters=yes
set envelope_from=yes
set use_from=yes
set from="xxxxxxx@richinfo.cn"
set realname="$HOSTNAME" #最好改为你自己邮箱账号名称以防止被误当垃圾邮件
修改.muttrc 的权限
sudo chmod 0600 ~/.msmtprc
否则会提示:
“.msmtprc: contains secrets and therefore must have no more than user read/write permissions”