Maildir: login mail notification and reading with mailx
With the delivery agents set to use Maildir, you can get a new-mail notification on login (including SSH) and read local mail with mailx or mail. Set the delivery agents to Maildir first.
- Do not edit
/etc/login.defs(deprecated). - Do not edit
/etc/profile– use/etc/profile.d/instead:
echo 'MAIL=$HOME/Maildir/' > /etc/profile.d/local_mailx.sh
- Install
heirloom-mailxormailutils(bsd-mailxdoes not work here). - Set the
pam_mail.sopolicy in/etc/pam.d/*(login,su,sshd): - in login and ssh:
pam_mail.so dir=~/Maildir standard - in su:
pam_mail.so dir=~/Maildir nopen
_Originally published in December 2013._