note · linux

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-mailx or mailutils (bsd-mailx does not work here).
  • Set the pam_mail.so policy 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._

published 12/2013updated 10/2026 tags: maildir · mailx · pam · debian linux →

← back to explore