Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

"You have mail." notification in shell - how to get rid of it?

Hey guys,

whenever I start a shell (zsh, but same for bash/csh/ksh) I get the message that "You have mail.". Well, that's true, there are mails in my /var/mail/`whoami`. But as they ain't new, I don't need, and more, don't want this message. How do I turn it off?

It's gone when I move my mail from /var/mail/$USER to somewhere else, but that is no solution.

Ideas? Clues? ANYthing?

Powerbook G4, Mac OS X (10.4.7)

Posted on Aug 18, 2006 2:56 AM

Reply
13 replies

Aug 18, 2006 6:17 AM in response to crazynd

Dear crazynd,

There are 2 ways to get rid of that pesky "Your have mail." notification.


Method 1

From command line type:

$ echo someEmailAddress@someISP.com>.forward

This will redirect your email to someEmailAddress@someISP.com.


Method 2

From command line type:

$ echo 'echo d|mail'>>.profile

This will delete your mail whenever you login. Although if you have lots of mail, you may need to exapand the .profile script to run in a loop to get all of the mail.


I hope this is of some help to you.

Your humble geek,



Kurt

Aug 18, 2006 9:04 AM in response to crazynd

Excerpt from the bash man-page on environment-variables; just type

man bash

in the Terminal to and go looking for MAIL. Presumably the other shells will have similar mechanisms.

MAILCHECK
Specifies how often (in seconds) bash checks for mail. The
default is 60 seconds. When it is time to check for mail, the
shell does so before displaying the primary prompt. If this
variable is unset, or set to a value that is not a number
greater than or equal to zero, the shell disables mail checking.

Aug 18, 2006 10:30 AM in response to doug pennington

the mail.rc differs in the first line:

set append dot save ask crt

Still something I did not change by hand (and I do not understand). Second line is the same.

What to do with mailstat? I mean, I do no there's no new mail, because fetchmail is not invoked, and nothing else is there to get new mails (yes, cron, but there IS no new mail, believe me). It's just that there is mail (not new mail) in /var/mail/`whoami`...

Aug 19, 2006 12:51 AM in response to crazynd

Hm.

There's something strange in how Terminal.app invokes the shell that I haven't had time to trace down yet; I can see the following:

Terminal.app with default settings does not invoke ~/.bashrc but displays the "you have mail" message.

Terminal.app set to launch /bin/bash neither invokes ~/.bashrc nor displays the "you have mail" message.

xterm in X11 invokes ~/.bashrc and does not display "you have mail".

I always use xterms because they seem to have better compatibility with more shell commands than Terminal.app.

The one thing I didn't try is to put the the MAILCHECK=-1 in /etc/profile and then reboot.

Aug 19, 2006 1:41 AM in response to Cohi

There's something strange in how Terminal.app invokes
the shell that I haven't had time to trace down yet;
I can see the following:
Terminal.app with default settings does not invoke
~/.bashrc but displays the "you have mail" message.
Terminal.app set to launch /bin/bash neither invokes
~/.bashrc nor displays the "you have mail" message.
xterm in X11 invokes ~/.bashrc and does not display
"you have mail".
I always use xterms because they seem to have better
compatibility with more shell commands than
Terminal.app.

The one thing I didn't try is to put the the
MAILCHECK=-1 in /etc/profile and then reboot.


Well, I use iTerm, but it's the same for Terminal.app
I also tried MAILCHECK='', MAILCHECK='-1' and all that... and if I check it, it's set, but still this **** message...

Geez, it can't be thaat hard, I thought!?

Aug 19, 2006 2:20 AM in response to crazynd

Hi,

The "You have mail." message is not from your shell but from login.
So you have two options to stop the message.

[1] Do not use login.
I'm not familiar with iTerm, but I think you can setup a bookmark which does not use login but directly invoke /bin/zsh.

[2] Tell login to be quiet.
Create a file ~/.hushlogin (it can be empty). See login(1) man page.

HTH

PowerMac G4 Mac OS X (10.4.7)

"You have mail." notification in shell - how to get rid of it?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.