发邮件,mail

[root@iZiu7zvk05r2opZ ~]# mail mailuser
Subject: test
hello world   
.
EOT
[root@iZiu7zvk05r2opZ ~]# systemctl start sendmail
[root@iZiu7zvk05r2opZ ~]# 

可在mailuser用户查看

[mailuser@iZiu7zvk05r2opZ ~]$ mail
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/mailuser": 2 messages 2 new
>N  1 root                  Mon Feb  8 17:12  26/1065  "test01"
 N  2 root                  Mon Feb  8 17:13  22/878   "test"
& 

按1 2查看邮件,按q退出

方法二,重定向发送邮件

[root@iZiu7zvk05r2opZ ~]# mail -s "test01" mailuser < /etc/hosts

-s 以xxx为标题 发给xxx用户 < 文件内容

原文地址:https://www.cnblogs.com/yxlll/p/14389690.html