inside the mind of a linux admin

Debian/Ubuntu Mailutils and Maildir

When setting up Maildir in Debian 5.0 or Ubuntu 10.x, getting the generic mail applications working correctly can be extremely tricky. When you type “mail” in a default/stock installation, it is attempting to read mbox data and will not read your “Maildir”. Annoying, since the stock configuration for mail delivery in most mail servers is now Maildir.

First, Install the ‘mailutils’ package, not the bsd mailx package.

apt-get install mailutils

Do not touch the mailutils /etc/mail.rc file; there are some promising looking variables here like mailbox-type but these do not do what is desired. When the MAIL environment variable is set correctly mailutils will automatically detect the maildir box type.

Do not touch /etc/login.defs; the promising looking lines in here are deprecated.

Edit files in /etc/pam.d, changing the pam_mail.so lines as shown (assuming ~/Maildir as the selected location):

login: default login shells
session optional pam_mail.so dir=~/Maildir standard

su: set up for proper MAIL when using su; nopen does not show ‘new mail’ message
session optional pam_mail.so dir=~/Maildir nopen

sshd: set up MAIL properly when logging in with ssh; this line probably has a noenv by default which needs removed to set this properly
session optional pam_mail.so dir=~/Maildir standard

Related Posts

How to revert back to X11 / Xorg from Wayland

Wayland is intended as a “simpler replacement for X”, and is getting quite a bit of hype around the Linux community. So much so, that it’s the default in the latest versions of Fedora, GNOME, KDE and others. While Wayland may be the future, it really is in future. At least for Ubuntu 17.10. The […]

Read More

Touchpad stops working after sleep + resume (Fedora 26 on Dell XPS)

After recently upgrading my Dell XPS 13 w/Touchscreen to Fedora 26, the touchpad suddenly stopped working upon resuming from sleep mode. It was reproduced 100% of the time, and required a complete restart in order to get the touchpad working again. There have been several forum posts and bug reports regarding others experiencing these exact […]

Read More

3 Comments

  • ssuchi on Wednesday, January 12, 2011

    Many thanks, good tip after hours of searching…

    For working with mutt without annoying questions you will have to add

    set mbox_type=Maildir
    set folder=~/Mail

    in /etc/Mutrc

  • neosapien on Thursday, March 10, 2011

    man….I spent 2 days trying to fix this very problem. This is exactly the second time in my life I have felt compelled to thank somebody via comment. Worked like a charm. Can’t thank you enough!

  • Phil on Wednesday, December 10, 2014

    Went here from AskUbuntu, really useful guide. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

Twitter: kireguy

Tweeter button Facebook button Myspace button