[root@localhost clh]# mail
No mail for root
[clh@localhost ~]$ mail -s "clh_test" root
i am chl^H^H^H^H #在写邮件过程中按删除键出现^H^H^H ,可以按ctrl+delete键进行删除
. #输入 “." 结束编写邮件。 “ctrl+c”就退出邮件发送了
[root@localhost ~]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 clh Thu Jul 31 14:45 22/631 "clh_test"
& header #查看邮件简要信息
>N 1 clh Thu Jul 31 14:45 22/631 "clh_test"
& 1
Message 1:
From clh@localhost.localdomain Thu Jul 31 14:45:43 2025
Return-Path: <clh@localhost.localdomain>
X-Original-To: root
Delivered-To: root@localhost.localdomain
Date: Thu, 31 Jul 2025 14:45:43 +0800
To: root@localhost.localdomain
Subject: clh_test
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: clh@localhost.localdomain (clh)
Status: R
i am clh
i miss a mikdate
& q #退出
Held 1 message in /var/spool/mail/root
您在 /var/spool/mail/root 中有邮件
[root@localhost ~]#
[clh@localhost ~]$ mail -s "no2mail" root # mail -s "邮件header 标题" 账户名称
test no2 mail
. #退出
EOT
[clh@localhost ~]$
[root@localhost ~]#
您在 /var/spool/mail/root 中有新邮件 #邮件发送完毕,在root账户下敲回车键会有邮件提示
[root@localhost ~]#
[root@localhost ~]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 2 messages 1 new
1 clh Thu Jul 31 14:45 23/642 "clh_test"
>N 2 clh Thu Jul 31 14:56 18/614 "no2mail"
& header
1 clh Thu Jul 31 14:45 23/642 "clh_test"
>N 2 clh Thu Jul 31 14:56 18/614 "no2mail"
& 1
Message 1:
From clh@localhost.localdomain Thu Jul 31 14:45:43 2025 #从clh@localhost.local发来的邮件
Return-Path: <clh@localhost.localdomain>
X-Original-To: root
Delivered-To: root@localhost.localdomain #发送给 root@localhost.localdomain的邮件
Date: Thu, 31 Jul 2025 14:45:43 +0800
To: root@localhost.localdomain
Subject: clh_test
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: clh@localhost.localdomain (clh)
Status: RO
i am clh
i miss a mikdate
& q #退出
Held 2 messages in /var/spool/mail/root
您在 /var/spool/mail/root 中有邮件
[root@localhost ~]#
[clh@localhost ~]$ mail -s "test02" root < ~/date #输入重定向,这时候不再显示写邮件了
[clh@localhost ~]$ cat ./date
bash: Date: 未找到命令...
相似命令是: 'date'
2025年 07月 31日 星期四 14:05:33 CST
2025年 07月 31日 星期四 14:05:35 CST
bash: Date: 未找到命令...
相似命令是: 'date'
[clh@localhost ~]$
[root@localhost ~]#
您在 /var/spool/mail/root 中有新邮件 #收到邮件提示
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 3 messages 1 new 2 unread
1 clh Thu Jul 31 14:45 23/642 "clh_test"
U 2 clh Thu Jul 31 14:56 19/624 "no2mail"
>N 3 clh Thu Jul 31 15:03 30/1010 "test02"
& 3 #查看第3封邮件
Message 3:
From clh@localhost.localdomain Thu Jul 31 15:03:47 2025
Return-Path: <clh@localhost.localdomain>
X-Original-To: root
Delivered-To: root@localhost.localdomain
Date: Thu, 31 Jul 2025 15:03:47 +0800
To: root@localhost.localdomain
Subject: test02
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=utf-8
From: clh@localhost.localdomain (clh)
Status: R
bash: Date: 未找到命令...
相似命令是: 'date'
2025年 07月 31日 星期四 14:05:35 CST
2025年 07月 31日 星期四 14:05:35 CST
bash: Date: 未找到命令...
相似命令是: 'date'
& q #退出
Held 3 messages in /var/spool/mail/root
[root@localhost ~]#