Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sometimes, when I log into a box and 'su' to root, I get a cute little message saying I have mail (thank GOD it's not AOL).

  • Where is this mail?
  • What does it contain?
  • Who/What sent it?
  • How important is it?

Is this even actual "mail" in the same sense as email? Or is it just my system telling me something?

EDIT: In relation to this question, would I be able to send myself mail using the sendmail program like so: email@localhost?

share|improve this question
7  
It was funny! (Sadly, it looks like we won't be getting "Humour" badges on this system.) =D –  Randolf Richardson Jul 4 '11 at 17:33
    
I have this one message in there that says "This text is part of the internal format of your mail folder,..." so of course whenever I log in I am informed that I have mail. –  GEdgar Jul 4 '11 at 20:38
    
@GEdgar: This usually means you should stop using mbox mailboxes and migrate to Maildir :) –  grawity Jul 4 '11 at 21:12
    
Related: superuser.com/questions/149282/… –  dmckee Jul 5 '11 at 1:42

6 Answers 6

up vote 87 down vote accepted
  • Where is this mail?

It's likely to be in the spool file: /var/mail/$USER or /var/spool/mail/$USER are the most common locations on Linux and BSD.

Other locations are possible – check if $MAIL is set – but by default, the system only informs you about /var(/spool)/mail.

Usually the spool file is in a very simple mbox format, so you can open it in a text editor or pager. For a slightly more convenient way, most distributions come with a program called mail (or Mail, mailx). You can try mutt or (re-)alpine; you can even configure it to be sent to an outside mailbox. (See "is this real mail?" below.)

  • What does it contain?
  • Who/What sent it?

Read it and find out :) Most often the messages contain output of cron jobs, or a system security report by logwatch, or similar junk.

  • How important is it?

Depends greatly on the contents of each message.

You should at least scan the subject headers – often people ignore the mail for months never realizing that their daily cron jobs fail.

Is this even actual "mail" in the same sense as email? Or is it just my system telling me something?

Yes, it's generated by your system telling you something. And yes, it's actual email, and can be handled as such.

You can (and often should) configure your mail software (the "MTA": postfix, exim4, sendmail, qmail) to forward the messages to your personal address – the exact instructions vary depending on which MTA (if any) you have installed, whether this is a personal computer or a server, whether you have your own domain or use a @gmail.com, and so on.

(Words of advice: Don't touch the Sendmail suite (which is not to be confused with the /usr/sbin/sendmail program). Other MTAs such as Postfix or Exim4 are just as powerful, and much less painful.)

share|improve this answer
8  
+1 for postfix/exim4 over Sendmail –  dr jimbob Jul 4 '11 at 22:53

The easiest way for me was to run the following in a terminal:

cat /var/spool/mail/root
share|improve this answer
2  
Best practical answer so far that actually adds to the knowledge. Now I can read the mail. I wonder why it's the bottom most answer. –  CDR Nov 29 '12 at 16:44
1  
I realize this is a pretty old question/answer, but this XKCD is relevant to the discussion. (hint: hover text) –  Blackhawk May 7 at 21:05

Just to offer some clarification, it's been the tradition for a long time for UNIX boxes to run a "locally configured" mailer daemon that doesn't route messages through the Internet, but only copies messages to other users spool directories (as @John T mentioned). It is real SMTP-compliant email, it's just not routed over the Internet because it doesn't need to be.

So, if you fire up an email client (like alpine or mutt) you can send mail to other users on the system by addressing to user@hostname, or in many cases, just specifying the user. You also likely have a command line utility called mailx that can be used to send a quick email using your shell.

Now, if you want to send messages to users on systems other than the one you are logged in to, that's where the real fun begins. You'll need to configure your mailer daemon to recognize and hand off external email to a transfer agent, configure the transfer agent, and do a whole bunch of stuff I don't yet understand myself.

share|improve this answer

Where is this mail?

Very likely stored on your machine, in the mailbox folder for your root user (where THAT is depends on what kind of mail server you have installed). You can probably access it quite quickly through alpine.

What does it contain?

Probably just some system report type stuff. "So and so tried to login 10 times with an incorrect password".. "I wish someone would run updates on me", "this hardware device appear to be dying".. etc..

Who/What sent it?

Services on your server, most likely.

How important is it?

Depends on how important your server is.

share|improve this answer
    
I think John's suggestion that it's stored in /var/spool/mail/root is based on a (good) assumption that you're running sendmail. I think other mail servers use different locations to store mail. –  Doc Jul 4 '11 at 15:30
    
Is there a way for users to use the mail subsystem? –  MaxMackie Jul 4 '11 at 15:31
    
White Phoenix: I'll take look when my mail is when I get the message again :) Is there a way for me to trigger it or is that too localized of a question? –  MaxMackie Jul 4 '11 at 15:32
    
If you want to explore running your own mail server (that people use in a typical email sense), it'd first help to know what distro you're running? Without that info, all I'll say, is that I suggest you read up on sendmail (as you're probably running sendmail already).. –  Doc Jul 4 '11 at 15:32
    
Most of them are running AIX but I'd like to explore this on my workstation at home running OpenSuSe –  MaxMackie Jul 4 '11 at 15:37

This mail is typically located in /var/spool/mail/root when the (usual) default sendmail daemon is configured. It contains a RAW e-mail message that can be read by the mail utility. Who sent it can be found by running the mail utility and paging through the messages or reading the RAW headers.

The importance of the message usually depends on the previous factor, who sent it :)

Many system utilities will use the mail subsystem as a means of reporting and logging. Log watcher utilities and other services may send an e-mail to the local root user as a reminder about a specific event, such as low disk space or hardware errors. The mailer daemon will also alert you if it failed to send an e-mail outbound.

share|improve this answer
    
Is there a way to see how my mail subsystem is set up? –  MaxMackie Jul 4 '11 at 15:29
    
@Max the sendmail.mc file controls configuration of the sendmail daemon on most default installs. It is typically located under /etc/mail. –  John T Jul 4 '11 at 15:34
    
thanks I'm off to check that file right now –  MaxMackie Jul 4 '11 at 15:36
    
@Max I would strongly recommend reading through a tutorial such as linuxhomenetworking.com/wiki/index.php/… to help you configure the mailer daemon as desired. –  John T Jul 4 '11 at 15:39

You may even read the mail in Thunderbird (and surely in other GUI-mail clients like evolution, opera, ...).

Create a new account 'localhost'.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.