Posted December 14, 2007
Offer multiple POP and IMAP mailboxes (with distinct passwords) using a single shell account.
How maildirpop3d finds mailboxes
If qmail-popup receives a username like "joe-foo", and ~joe/Maildir-foo is a directory, then maildirpop3d invokes qmail-pop3d (as joe) on ~joe/Maildir-foo.
If qmail-popup receives a username like "email@example.com", and "example.com:joe" appears in /var/qmail/control/virtualdomains, and ~joe/Maildir-foo is a directory, then maildirpop3d invokes qmail-pop3d (as joe) on ~joe/Maildir-foo. Since version 0.3.
If the supplied username is "joe-foo-bar-baz", then maildirpop3d looks first for a user called "joe-foo-bar-baz", then "joe-foo-bar", then "joe-foo", then "joe". If a user called "joe-foo-bar" exists, then maildirpop3d will not look for users called "joe-foo" or "joe", even if ~joe-foo-bar/Maildir-baz/ does not exist.
How passwords are stored
How to install (part 1)
First, install the maildirpop3d programs:
mkdir -p /usr/local/src cd /usr/local/src fetch http://tomclegg.net/software/maildirpop3d-0.8.tar.gz tar xzf maildirpop3d-0.8.tar.gz cd maildirpop3d-0.8 make install
How to install (part 2, POP3)
Add maildirpop3d to your existing POP3 service. It runs between qmail-popup and qmail-pop3d.
exec tcpserver -vRl YOUR.HOST.NAME.HERE 0 pop3 \ /var/qmail/bin/qmail-popup YOUR.HOST.NAME.HERE \ /usr/local/sbin/maildirpop3d /var/qmail/bin/qmail-pop3d Maildir
If you're using a checkpassword program other than checkpassword, or if checkpassword is not in your PATH, then you need to add the path to checkpassword as the last argument to maildirpasswd:
exec tcpserver -vRl YOUR.HOST.NAME.HERE 0 pop3 \ /var/qmail/bin/qmail-popup YOUR.HOST.NAME.HERE \ /usr/local/sbin/maildirpop3d /var/qmail/bin/qmail-pop3d \ Maildir /PATH/TO/CHECKPASSWORD
How to install (part 3, IMAP)
cd /usr/ports/mail/dovecot && make install cd /usr/local/etc cp -ip dovecot-example.conf dovecot.conf
Edit the configuration file (
If you made those changes and removed the comments, you would have something like this sample dovecot.conf.
Enable dovecot in /etc/rc.conf.
echo >>/etc/rc.conf 'dovecot_enable="YES"'
Test using an IMAP client like squirrelmail.
The above method prevents the IMAP server from accessing regular user maildirs like /home/joe/Maildir using username "joe" and joe's unix password. A future version will fix this. Meanwhile, I came up with a truly awful hack to make both work at once.
How to use
If your username is
cd maildirmake Maildir-lists echo ./Maildir-lists/ >.qmail-lists maildirpasswd lists Changing password for POP mailbox joe-lists@YOUR.HOST.NAME.HERE New password: bar New password (again): bar Ok, putting encrypted password 0ZsfajRLIfp0w in ~/Maildir-lists/passwd
(Your password will not really appear on your screen.)
You can pick up your mail by configuring your mail reader like this:
POP server: YOUR.HOST.NAME.HERE Username: joe-lists Password: bar
If virtualdomains contains the line "example.com:joe", you can use these settings:
POP server: YOUR.HOST.NAME.HERE Username: firstname.lastname@example.org Password: bar
This package is released under the GNU General Public License.
Note: None of this stuff has any kind of warranty.