Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I open up my terminal it says "you have mail", anyone has any idea of why? I am running OS X, but since it too is based on Unix and relies on files such as bashrc, bash_profile etc. I thought somebody here might know, and I'm not sure it's a platform specific problem!

share|improve this question

3 Answers 3

up vote 20 down vote accepted

It sounds like something has sent mail on (and to) the machine using the local mail exchanger. Most likely the email is an automated message from some installed package. Once you log in, type mail on the terminal to read and (presumably) delete the relevant mail. (Inside mail, use ? to find out what the commands are.) Once you've read or deleted any unread mail, you won't see the "You have mail" message again until/unless something else sends mail in the same way. Odds are once you know what's sending you the mail, you can find a configuration option to change where it sends it to.

share|improve this answer
    
That was exactly what had happened! And it was solvable the way you told me. Thanks a lot :) –  Calle Sep 25 '10 at 14:54
    
@Calle: Good deal, glad that helped! –  T.J. Crowder Sep 25 '10 at 15:13

It is a "platform specific problem" :-)

Mac OS X uses as default shell the BASH like many other Un*x/Linux systems.

Mail from your system is stored in mailbox for your user, often located in /var/mail/$user

Because sometimes your mailbox will contain important messages (a failed cronjob task, etc.) you don't to check it every time by yourself.

The BASH (and many other shells) have a feature called mailcheck, which outputs your message the first time you open your terminal.

$MAILCHECK is an environment variable which contains the seconds when its time to check for new mail. Mail is also checked before displaying the primary prompt. See more in man bash - Bash Variables.

To prevent the checks for new mail, you can simply unset $MAILCHECK. The right place for this is your .bashrc file, which will be read when you open up a shell. Its in your user home directory.

Append to ~/.bashrc:

unset MAILCHECK

to disable the message.

Of course it is also possible to simply delete the mails like T.J. Crowder mentioned :-)

share|improve this answer

Using Raspian (Debian based distro for Raspberry Pi) over SSH, I had to comment out the following line in /etc/pam.d/sshd to get rid of it.

session    optional     pam_mail.so standard noenv # [1]
share|improve this answer
3  
Could you comment a bit more on how you found this out? It might be of help to people with similar questions. –  vonbrand Feb 26 '13 at 13:52
    
I found the solution in a mailing list. the author says he stumbled over the line when poking around in /etc/pam.d/sshd. I’m afraid that’s all I know. –  Frode Feb 26 '13 at 14:14
    
This fixed it for me on ubuntu as well. –  Jacob Mar 20 '13 at 1:27

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.