linux 使用 mailx 发送邮件
安装
# yum install mailx
# rpm -qa |grep mail
mailcap-2.1.31-2.el6.noarch
mailx-12.4-8.el6_6.x86_64
libreport-plugin-mailx-2.0.9-32.el6.centos.x86_64
配置
# vi /etc/mail.rc
set from=1234567890@163.com
set smtp=smtp.153.com
set smtp-auth-user=1234567890@163.com
set smtp-auth-password=xxxxxxxxxx
set smtp-auth=login
发送邮件
# echo "邮件正文" | /bin/mailx -v -s "邮件主题" peiyb@163.com
# echo "邮件正文" | /bin/mailx -v -s "邮件主题" -a /root/install.log peiyb@163.com
多附件,多收件人
# echo "邮件正文" | /bin/mailx -v -s "邮件主题" -a /root/install.log -a /root/install2.log peiyb@163.com,peiyb1@164.com