AFAIK mail notification is a shell function, in bash by setting the MAIL environment variable and it has little to nothing to do with the
mailx command. In a different shell it may function differently.
In my RHEL system it is configured in
A simple echo $MAIL will show if it is set or not.
At first glance it only works with mbox style mailboxes and not with Maildir where each message is stored in a separate file.
From the bash manual page:
MAIL If this parameter is set to a file name and the MAILPATH vari-
able is not set, bash informs the user of the arrival of mail in
the specified file.
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.
A colon-separated list of file names to be checked for mail.
The message to be printed when mail arrives in a particular file
may be specified by separating the file name from the message
with a '?'. When used in the text of the message, $_ expands to
the name of the current mailfile. Example:
MAILPATH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has
Bash supplies a default value for this variable, but the loca-
tion of the user mail files that it uses is system dependent
In the csh manual on that same system it seems lower case
The mail shell variable can be set to check for new mail periodically.
mail The names of the files or directories to check for incoming
mail, separated by whitespace, and optionally preceded by a
numeric word. Before each prompt, if 10 minutes have passed
since the last check, the shell checks each file and says 'You
have new mail.' (or, if mail contains multiple files, 'You have
new mail in name.') if the filesize is greater than zero in
size and has a modification time greater than its access time.
If you are in a login shell, then no mail file is reported
unless it has been modified after the time the shell has
started up, to prevent redundant notifications. Most login
programs will tell you whether or not you have mail when you