background
You have mail will be prompted when you open the built-in shell or iterm on the Mac computer. I didn’t care before, because I am engaged in network security work. I usually operate and plan tasks when studying the Mac. I did test it before, but it has been cleared manually, but why is there such a prompt?
process
The overall process should be as follows: first, the mail mechanism of MAC itself, especially the problem of planned tasks, that is, if the machine planned tasks are not executed as expected, it will report errors, The error result will be sent to the user in the form of e-mail and stored in:/var/mail/user name. This file is also true for Linux. So when you open the shell, you will be reminded that there are emails here. Because the SH script executed in the planned task was deleted when the planned task was created, but the planned task itself was not deleted, so the planned task reported an error and sent a lot of emails. At this time, the message received is: you have new mail, but after the prompt is completed, After that, the prompt becomes you have mail. Use the mail command to view the specific mail content:
From [email protected] Mon Aug 30 11:24:01 2021
X-Original-To: hait
Delivered-To: [email protected]
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <hait@B61zz> /tmp/evil.sh
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=hait>
X-Cron-Env: <USER=hait>
Date: Mon, 30 Aug 2021 11:24:00 +0800 (CST)
/bin/sh: /tmp/evil.sh: No such file or directory
Analyze the reason: it can be judged from the time that it is the email in August, which makes sense at this time. The whole process:
1. Establish the planned task and run normally;
2. Delete the SH file executed by the planned task, resulting in an error message, and then send the e-mail.
3. Delete the planned task (stop sending the error message);
4. Message unread always prompt
Solution:
1. You can directly turn off the terminal mailbox function. The link above has the command (I failed, I used plan2)
2. Delete this folder:/var/mail/user name
Similar Posts:
- How to Remove the Note: You have new mail in /var/spool/mail/root
- [Solved] smtplib Sent Email Error: SMTPDataError: (554, ‘DT:SPM 163 smtp1
- Phpmailer’s solution to extension missing: OpenSSL error
- GulpThe following tasks did not complete [How to Solve]
- [Solved] Python Error: CentOS failed to send mail without any error message
- You have new mail in / var / spool / mail / root prompt appears in Linux, and the solution to close the email prompt and clean up the content is given
- [Solved] Windows ADB devices port is occupied error: cannot connect to daemon
- Python Send Email Error: smtplib.SMTPException: SMTP AUTH extension not supported by server
- AndroidStudio Error: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:app:proces
- Laravel 5.1 mail sending error swift_ TransportException