Managing Maildirs
Odhiambo Washington
wash at wananchi.com
Sat Dec 20 02:08:05 PST 2003
* Eric Anderson <anderson at centtech.com> [20031219 22:33]: wrote:
> Bill Campbell wrote:
>
> >Number one above will do the trick and is far more efficient than using the
> >``find ...-exec'', although you might want to modify it to only nuke mail
> >over a certain age. To nuke all trash over 30 days old:
> >
> > find /home/*/Maildir/.Trash -type f -mtime +30 | xargs rm
> >
>
> On a totally unrelated note, I'm thinking about switching from mbox
> formatted mailboxes using imap, to a more robust and faster imap server
> that uses maildirs.
That is a very easy move. Just don't get scared. I did it and it wasn't
difficult. Planning is required. All I had to do was:
1. Make my mail server to run in queue_only mode. No deliveries. BTW I
run Exim (http://www.exim.org).
2. I changed the config file for Exim to change a transport from doing
delivery to mboxes to Maildir.
3. Ran a script to convert all the mboxes that I had into Maildir. The
emails were in /var/mail/$user for all users (they were about 7k
then). Since the MTA would now deliver mails into
/home/$user/Maildir, I simply run a simple "redeliver" command:
cd /var/mail
for mbox in `ls -1`; do formail -Y -s sendmail \
$mbox at our.domain.tld.com < $mbox; done
When that process completed ...
4. Restarted the MTA on "deliver" mode. All mail got redelivered. I
didn't care whether they seemed new or not. The important thing is
that they were there. I assumed they were new mail. Some users left
mail on the server. That was their own problem. Sometimes an admin
must have a tough skin, like the armadillo ;)
5. rm -rf /var/mail/* (that is where the mboxes lived)
> My problem is, I have pop users, imap users, and elm/mutt/pine users
> on the same box.
That is not a problem. Their e-mail will be "there", only they may not
be able to access it until they change their configs. Mutt users must
change their .muttrc. I believe elm will work staright, but not sure.
I used pine long ago so I can't comment on it. I use mutt all these
days!
> Does elm/mutt/pine work ok with maildirs?
Definately.
> What about sendmail?
Sendwhat?? ;-)
Please use a sane MTA. If you can't use Exim, use Postfix ;-)
I can only talk about Exim for that is what I use. It has no problem at
all delivering to Maildir.
> What should I be looking out for?
I believe a perfect script to migrate your mboxes to $home/Maildir.
I have attached the script. If you have the mail located elswhere, you
can use this script:
#!/usr/local/bin/bash
DIRNAME="/var/mail"
cd $DIRNAME
for user in `ls`; do
mv $user $user.mbox
maildirmake ~$user/Maildir
perfect_maildir.pl ~$user/Maildir < $user.mbox
chown -R $user ~$user/Maildir
chgrp -R mail ~$user/Maildir
chmod 700 ~$user/Maildir
find ~$user/Maildir/ -type f | xargs chmod 660
rm -f $user.mbox
done
NB: Please test this with some test account before you run it for all
users.
You will need courier-imap. Very easy to get up and running. If you want
fancy life, go for Cyrus. I've never tried it because it's rather
complicated, but maybe it's the swiss knife of imap servers?
-Wash
http://www.netmeister.org/news/learn2quote.html
--
+======================================================================+
|\ _,,,---,,_ | Odhiambo Washington <wash at wananchi.com>
Zzz /,`.-'`' -. ;-;;,_ | Wananchi Online Ltd. www.wananchi.com
|,4- ) )-,_. ,\ ( `'-'| Tel: +254 20 313985-9 +254 20 313922
'---''(_/--' `-'\_) | GSM: +254 722 743223 +254 733 744121
+======================================================================+
While most peoples' opinions change, the conviction of their
correctness never does.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-isp/attachments/20031220/d8ea0a32/attachment.bin
More information about the freebsd-isp
mailing list