Monitoring mailbox in Maildir format with bash and pam_mail

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:

export MAIL=~/Maildir

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”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.