Read messages from “You have new mail in /var/mail/root”

Ubuntu logoWhen logging into your Ubuntu server, you might be greeted with the message You have new mail in /var/mail/root. But how do you read that mail and how did it get there?

It means that you have installed sendmail on Ubuntu (or any other flavour of Linux) and you received one or more messages in your inbox. The message(s) can originate from your system itself, or from an external e-mail address.

Read your messages in Ubuntu

To see what messages you received from the command line, this command will reveal the message(s):

<code>cat /var/spool/mail/root</code>

The message could look like this:

From [email protected] Wed Jul 29 12:05:26 2015
Return-Path: <[email protected]>
Received: from hostname (localhost [127.0.0.1])
by hostname (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id t6TG5QKu001540
for <[email protected]>; Wed, 29 Jul 2015 12:05:26 -0400
Received: (from [email protected])
by hostname (8.14.4/8.14.4/Submit) id t6TG5QYK001533;
Wed, 29 Jul 2015 12:05:26 -0400
Date: Wed, 29 Jul 2015 12:05:26 -0400
Message-Id: <[email protected]>
To: [email protected]
From: [email protected]
Auto-Submitted: auto-generated
Subject: *** SECURITY information for hostname ***

hostname: Jul 29 12:05:26 : root : unable to resolve host hostname

Removing messages from /var/mail/root

To purge these messages and to get rid of the message you received on logging in, you can simply delete it with this command:

[email protected]:~# > /var/spool/mail/root

Do not forget to include the > sign, otherwise it won’t work.

 

Author Bio

Thank you for your interest in my blog! On this miniblog, I write mostly short (technical) blog posts that might interest other people. Read more about me or feel free to contact me.

 

Leave a Reply

Your email address will not be published. Required fields are marked *