After switch to Maildir format mailbox my bash stopped monitoring new mail. To bring this functionality back I need to set location of my new mailbox:
And after $MAILCHECK seconds I got You have new mail in /home/kb/Maildir.
To set $MAIL for all login shells and for all user I use pam_mail. To enable checking ~/Maildir for new mail use:
session optional pam_mail.so standard dir=~/Maildir
Probably modification in /etc/pam.d/login and /etc/pam.d/sshd are sufficient.
One thought on “Monitoring mailbox in Maildir format with bash and pam_mail”
Thanks for the tip about /etc/pam.d/sshd … i only set /etc/pam.d/login and wondered why it still didn’t work when logging in via ssh.