系统直接发送邮件,经常被企业邮箱当垃圾邮件屏蔽
- 安装
- debian
apt-get install msmtp mutt -y
- centos
yum install msmtp mutt -y
- 配置msmtprc
vim /etc/msmtprc
account default
host smtp.163.com #smtp服务器
domain 163.com
from monitor@163.com
auth login
user monitor@163.com #账号
password *************** #密码
logfile /var/log/maillog
cat >> /etc/Muttrc <<EOF
set sendmail="/usr/bin/msmtp"
set use_from=yes
set realname=monitor
set from=monitor@163.com
set envelope_from=yes
set editor="vi"
#防止MUTT发送中文乱码
set charset="utf-8"
set rfc2047_parameters=yes
EOF
echo "This is test email" |mutt -s "Test send mail" 收件人(多个可逗号隔开) -c 抄送人 -a 附件 < 导入文件内容发送.txt