11

I'm quitting GMail but attempting to avoid the headaches that come with administering my own Internet-facing IMAP server. I have access to a commercial IMAP account, and I'd like to continue to use that account.

Basically the way I'd like it to work is that mail is downloaded to my server and deleted from my mailbox on the commercial IMAP server. Then once on my server it's served up via IMAP and webmail, so that it can be used on mobile + internet devices, and remains in sync across both.

Things it must do:

  • Be accessible from all devices
  • Relatively fast searching
  • Threaded viewing of message replies (preferably with my sent mails interspersed)

Here's how I see it working:

Mail arrives at commercial IMAP server ->
On my server, fetchmail downloads via IMAP and delivers to ->
MDA/MTA, which updates a search cache for rapid searching and makes it available via IMAP to ->
Horde IMP, which caches the e-mails in the inbox for faster previewing

The Question

I'm looking for an MDA/MTA pair that can be delivered to by fetchmail, emphasizes security, and supports search cacheing on this scale (so when I search the inbox in IMP it doesn't take forever). My plan is to be GMail-like in that I'll likely not put things in folders but leave everything in the Inbox and search it when I need to find anything.

Any other thoughts on the sanity/insanity of this welcome, but my main concern is the MDA/MTA.

3
3

Dovecot supports the IMAP SEARCH function, plus it's a pretty simple IMAP service to run. It can read a variety of mailbox formats, so as long as you use fetchmail to deliver into the appropriate format (or to procmail), it should work fine.

As for webmail interfaces, there are so many, I wouldn't know where to start. I like RoundCube, but it's more for the traditional IMAP mail format with lots of folders, so it might not fit your needs.

4
  • Dovecot looks great for performance. Is there a way to set it up so that outgoing mail is added to the Inbox (so that it both received and sent messages can be threaded in the way that GMail does)? I'm running RoundCube right now and just directly connecting to the commercial IMAP server. It's great, but the address book and calendar integration of Horde are tempting. – Ari B. Friedman Jun 10 '13 at 2:33
  • Trivially, you can configure your mail client to Bcc: yourself. – tripleee Jun 10 '13 at 8:00
  • Good point. I will try that. – Ari B. Friedman Jun 10 '13 at 10:57
  • Marking this as the answer since it's what I ultimately went with. fetchmail has an MTA argument, which I set to Dovecot's deliver. That way I can use the mdbox format, which means that as e-mails come in they are indexed for fast search. Works like a charm so far. – Ari B. Friedman Jun 13 '13 at 13:31
3

I have had a similar setup for several years now, picking up emails with IMAP (and POP). Initially with some other IMAP server but now with dovecot.

The performance of the different mailbox formats is very different, especially if you have a large amounts of emails and start moving out things that belong together to a new mail folder. Some formats put all the mail together in one file, which often meant rewriting several hundred Mb (caused by attachments.

My setup:

  1. Optional: Make a separate account mailman for picking up the email and storing the mail for IMAP. I have this setup because I sometimes run incompatible versions of desktop applications in my home directory and have multiple ones (e.g. because my old Dell Latitude 800 grafics only works well with Ubuntu 10.04). I can move my (mail) data separate from my home (mostly version specific configuration files, Desktop directory and links to data).

  2. picking up with fetchmail e.g. from a cronjob and the following entry in .fetchmailrc:

     poll servername proto imap user useronserver pass serverpasswd ssl is mailman here;
    

    Of course you can pickup mail from multiple providers and also use POP.

  3. Have postfix deliver through procmail by specifying in /etc/postfix/main.cf:

    mailbox_command = procmail -a "$EXTENSION"
    
  4. You can use procmail to put the mail in the right mailbox e.g. by using the following .procmailrc:

     PATH=/bin:/usr/bin:/usr/local/bin
     MAILDIR=$HOME/Maildir
     LOGFILE=$HOME/pm.log
     DEFAULT=$MAILDIR/
     FROM=your@email.adr
    

    Important is the / at the end of your DEFAULT address. This will give you maildir format mailboxes (or use /. for MH format) AFAIK there is no option to specify a mailbox format. Indexing on this is done

  5. Optionally add rules to deliver mail matching the fule in specific folders (again, don't forget the /):

    :0
    * ^Subject:.*\[sosx-dev\]
    $MAILDIR/.Mailing.sosx/
    

    This delivers mail matching the subject to a submailbox sosx under mailbox Mailing

  6. Dovecot is capable of serving the above without problems.

I normally use Firefox to access the information and because of the procmail setup (and Maildir) don't have to specify IMAP server directory etc (can just go with the defaults after giving the mailman name as user and its passwd).


If you are going to serve to the internet make sure you only use SSL to connect to dovecot (otherwise you would not have needed to bother about privacy)

2
  • @An thon This is fantastic thanks. Re: The SSL and privacy, I don't actually worry about any particular mail being intercepted-- have nothing to hide--I just don't want every email I've ever written available to be leaked, data mined for profit, or twisted out of context. – Ari B. Friedman Jun 10 '13 at 11:01
  • I understand, but using SSL (STARTTLS also hides your normal plaintext imap password exchange, but there are other ways to hide that as well). – Anthon Jun 10 '13 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.