一、安装:
-
安装sendmail:
yum -y install sendmail systemctl start sendmail
-
安装mailx:
yum install -y mailx
二、发送:
-
通过文件内容发送:
mail -s 'subject' example@163.com < example.txt
-
通过管道符直接发送:
echo 'content' | mail -s 'subject' example@163.com
三、设置发件人信息:vim /etc/mail.rc
set from=example@163.com set smtp=smtp.163.com set smtp-auth-user=example@163.com set smtp-auth-password=密码 set smtp-auth=login
四、查看队列:
mailq
五、查看日志:
tail /var/log/maillog