Re: Managing Maildirs

From: Odhiambo Washington (wash_at_wananchi.com)
Date: 12/20/03

  • Next message: nanard: "Re: /etc/ipf.conf - ipfilter"
    Date: Sat, 20 Dec 2003 13:07:45 +0300
    To: freebsd-isp@freebsd.org
    
    
    
    

    * Eric Anderson <anderson@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@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@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 message: nanard: "Re: /etc/ipf.conf - ipfilter"

    Relevant Pages

    • Re: OT - Scalable email server solution needed
      ... Maildir has a number of advantages over mbox. ... shutting down the SMTP, POP, or IMAP server. ... It supports Maildir and PostgreSQL databases. ...
      (freebsd-questions)
    • Re: light IMAP server for personal use
      ... small IMAP server in my home box, for local delivery/management of my maildir ... What would be the lightest/simplest/fastest IMAP server, ... I'd say give dovecot a try. ... and I have dozens of folders and gigabytes of ...
      (Ubuntu)
    • Re: Recommended IMAP server
      ... Dovecot is that it leaves your mail files in a readable format, ... all else fails you can still read/search your emails. ... I run exim here, ... I realise that's not part of the IMAP server as ...
      (comp.os.linux.networking)
    • Re: Need to export All-In-One files to a PC
      ... All I need to do is just get the documents in ASCII format ... Could I export the folder to something and then FTP it ... Note that more recent versions of A1 have an IMAP server and that could ... script that converts all yoru documents to text form before transfering ...
      (comp.os.vms)
    • Re: exim4
      ... interface or do you have to install 3rd part applications for this ... To connect to an IMAP server to read your mail you need a mail client ... If however you are talking about setting up pop3/imap/web servers exim ... I am busy learning exim4 for a competition where I may get asked ...
      (Debian-User)