Saving in MAILDIR format with Sendmail

Matthew Seaman m.seaman at
Sat Apr 1 14:57:16 UTC 2006

Gerard Seibert wrote:
> I presently have Sendmail as my MTA. The mail in /var/mail is in MBOX 
> format. I wanted to change it to MAILDIR format.
> 1) Is it possible for Sendmail to save in MAILBOX format directly?
> 2) If not, can ProcMail be used in this scenario? If so, how would I 
> configure it? I Googled and noticed something about ending directory 
> paths in '/' but I did not really understand what it was referring to.
> 3) If someone has a better solution, I would love to hear it.

It's not actually sendmail that saves the messages on final delivery,
but the local mail delivery process that sendmail hands the message off to.

By default that is mail.local(8) which only supports the Berkeley mbox
format.  So in order to make sendmail deliver e-mails Maildir style, you
will need to substitute a different local delivery agent.  procmail(1) is
a possibility, as it handles both mbox and Maildir formats.

To make procmail the default delivery agent, add


to your /etc/mail/`hostname`.mc file and generate and install a new in the usual way[1].

Now you can set up a ${HOME}/.procmailrc for each e-mail user specifying
delivery to a Maildir setup by default:


(Procmail assumes Maildir format if the mailbox name ends in a trailing
'/' character, indicating that it is actually a directory rather than a
plain file.)

Remember to create the directories and set ownership and permissions
first.  It might be better to deliver the mail to somewhere under each
user's home directory rather than under /var/mail.  Undoubtedly there will
be a method of making that style of delivery the default without having to
have individual .procmailrc files in each user account, but that you'll
have to google for.



[1] cd /etc/mail ; make && make install && make restart

Dr Matthew J Seaman MA, D.Phil.                       7 Priory Courtyard
                                                      Flat 3
PGP:         Ramsgate
                                                      Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url :

More information about the freebsd-questions mailing list