I connect to my Ubuntu 20.04.2 LTS server via SSH, and the "You have new mail" notification works properly when logging in, however, if I receive mail while already logged in, I don't get any kind of notification.

I remember this working properly on other Linux systems in the distant past and I can find references online regarding it working for other people but no instructions on how to make it work.

If I receive mail while logged in I'd like the terminal to automatically display a notification message.

Based on searches for possible solutions, I checked the value of the "$MAILCHECK" environment variable and found that it's already set to 60 seconds, so I haven't made any adjustments to it.

I found a package named "mailcheck" that was not installed so I installed it, however, nothing visibly changed. Manually running the "mailcheck" command never outputs anything even when I know I have mail in the mailbox.


I eventually found that there's an environment variable $MAIL that's supposed to be set but (for some reason) wasn't.

So I set it via my .bashrc:


This resolved the issue.

The "mailcheck" package ended up being irrelevant so I purged it.

The following documents were useful in solving this:



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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