苹果电脑(mac) 终端(shell) 出现 You have new mail 的解决办法

yufei       2 年, 7 月 前       2408

其实吧,这个 You have new mail. 不解决也没什么问题。但处女座的我们,看到了多出来的这一串总是有点别扭

Last login: Fri Aug 20 16:52:51 on ttys003
You have new mail.
yufei@yufei ~ % 

You have new mail 其实是系统给我们发了一封邮件,我们没有处理它而已。

首先我们来看看这封邮件到底是什么,在终端敲入 mail 后回车

yufei@yufei ~ % mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/mail/yufei": 106 messages 106 new
>N  1 MAILER-DAEMON@yufei.  Wed Apr 21 12:07 102/3674  "Undelivered Mail Retu"
 N  2 MAILER-DAEMON@yufei.  Wed Apr 21 13:43 101/2938  "Undelivered Mail Retu"
 N  3 MAILER-DAEMON@yufei.  Wed Apr 21 13:43 197/11148 "Undelivered Mail Retu"
 N  4 MAILER-DAEMON@yufei.  Wed Apr 21 17:10 102/3766  "Undelivered Mail Retu"
 N  5 MAILER-DAEMON@yufei.  Wed Apr 21 18:36  97/3276  "Undelivered Mail Retu"
 N  6 MAILER-DAEMON@yufei.  Wed Apr 21 18:45  97/3227  "Undelivered Mail Retu"
 N  7 MAILER-DAEMON@yufei.  Wed Apr 21 18:46  93/3111  "Undelivered Mail Retu"
 N  8 MAILER-DAEMON@yufei.  Wed Apr 21 20:35  93/3111  "Undelivered Mail Retu"
 N  9 MAILER-DAEMON@yufei.  Wed Apr 21 20:35  97/3190  "Undelivered Mail Retu"
 N 10 MAILER-DAEMON@yufei.  Wed Apr 21 20:40  93/3111  "Undelivered Mail Retu"
 N 11 MAILER-DAEMON@yufei.  Wed Apr 21 20:40  93/3061  "Undelivered Mail Retu"
 N 12 MAILER-DAEMON@yufei.  Wed Apr 21 20:45  93/3111  "Undelivered Mail Retu"
 N 13 MAILER-DAEMON@yufei.  Wed Apr 21 20:45  95/3085  "Undelivered Mail Retu"
 N 14 MAILER-DAEMON@yufei.  Thu Apr 22 15:32  93/3111  "Undelivered Mail Retu"
 N 15 MAILER-DAEMON@yufei.  Thu Apr 22 15:33  97/3176  "Undelivered Mail Retu"
 N 16 MAILER-DAEMON@yufei.  Thu Apr 22 15:33  93/3115  "Undelivered Mail Retu"
 N 17 MAILER-DAEMON@yufei.  Thu Apr 22 15:34  97/3164  "Undelivered Mail Retu"
 N 18 MAILER-DAEMON@yufei.  Thu Apr 22 15:36  93/3115  "Undelivered Mail Retu"
 N 19 MAILER-DAEMON@yufei.  Thu Apr 22 15:36  97/3160  "Undelivered Mail Retu"
 N 20 MAILER-DAEMON@yufei.  Fri Apr 23 14:01  93/3115  "Undelivered Mail Retu"

好多邮件没读啊,囧,106 封啊

我们可以继续输入 1 然后回车,看 N 1 这封邮件的内容,你想看第几封,就输入对应的数字

Message 1:
From MAILER-DAEMON  Wed Apr 21 12:07:21 2021
X-Original-To: yufei@yufei.local
Delivered-To: yufei@yufei.local
Date: Wed, 21 Apr 2021 12:07:21 +0800 (CST)
From: MAILER-DAEMON@yufei.local (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: yufei@yufei.local
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="8E29E4929CB0.1618978041/yufei.local"
Content-Transfer-Encoding: 8bit

This is a MIME-encapsulated message.

--8E29E4929CB0.1618978041/yufei.local
Content-Description: Notification
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This is the mail system at host yufei.local.

:

可以继续按回车键来查看更多内容,或者列出更多封。

Message 1:
From MAILER-DAEMON  Wed Apr 21 12:07:21 2021
X-Original-To: yufei@yufei.local
Delivered-To: yufei@yufei.local
Date: Wed, 21 Apr 2021 12:07:21 +0800 (CST)
From: MAILER-DAEMON@yufei.local (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: yufei@yufei.local
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="8E29E4929CB0.1618978041/yufei.local"
Content-Transfer-Encoding: 8bit

This is a MIME-encapsulated message.

--8E29E4929CB0.1618978041/yufei.local
Content-Description: Notification
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This is the mail system at host yufei.local.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

不想继续看了就按 q 键退出

To: admin@admin.com
? q
Saved 2 messages in mbox
Held 104 messages in /var/mail/yufei

如果看的烦,可以直接运行下面的命令删除所有邮件,

sudo rm /var/mail/yufei
sudo touch /var/mail/yufei 

你需要将 yufei 替换成你自己的终端的昵称。或者直接 ls 一下看看有啥文件

yufei@yufei ~ % ls /var/mail
yufei

再次打开终端就没有了

Last login: Sat Aug 21 09:18:49 on ttys000
yufei@yufei ~ % 

但是呢,系统仍然可以给你发送邮件,哈哈,因为我们没关闭

对于大部分用户来说,其实是可以直接关闭终端邮箱功能的,运行下面的命令即可

Ubuntu / CentOS

sudo echo "unset MAILCHECK">> /etc/profile

Mac 苹果电脑

sudo echo "unset MAILCHECK">> /etc/profile
目前尚无回复
简单教程 = 简单教程,简单编程
简单教程 是一个关于技术和学习的地方
现在注册
已注册用户请 登入
关于   |   FAQ   |   我们的愿景   |   广告投放   |  博客

  简单教程,简单编程 - IT 入门首选站

Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.