Tuesday, February 26, 2008

Sendmail: Maildir format

Here's a quick one: on FreeBSD, how to configure sendmail to deliver mail in Maildir format?

...Using procmail for this example.

Let's assume the user in question is called test.

1. First, create a Maildir for the user:
for x in cur new tmp ; do
mkdir -p /home/test/Maildir/${x}
done
chown -R test:test /home/test/Maildir
chmod -R 700 /home/test/Maildir
2. Install procmail and edit the user's .procmailrc file:
pkg_add -rv procmail
echo ":0" >> /home/test/.procmailrc
echo "/home/test/Maildir/" >> /home/test/.procmailrc
3. Tell sendmail to use procmail as delivery agent (suppose my hostname is dvorak):
cd /etc/mail
vi dvorak.mc
Add the line:
FEATURE(local_procmail)dnl
Save, quit; build the new sendmail.cf:
make && make install && make restart
Done. Now sendmail will deliver all mail for test@dvorak in /home/test/Maildir(/new).

0 comments:

Post a Comment