Configuring Fetchmail -> Postfix -> Cyrus -> IMAP

A nightmare over several days. I had set my mind that a local store was no good, because I needed to be able to access my email from outside the apartment, and decided that IMAP would be the way to go.

Technically, what I needed to do was to take the mail I got from my outside provider and download it to my server (this one). Then I needed to pass that email to an IMAP server, finally to get to it from the outside world. This seems stupid at first, but I run a dozen filters on my email, so that it makes very little sense for me to access the email directly on my ISP’s site.

I set my mind on the following flow (that pretty much was determined by the way SuSE does things):

  1. fetchmail would download the email from the ISP in a cron job
  2. postfix would deliver said email on
  3. cyrus-imapd would make it available

As mentioned, after a few days everything started running smoothly – but initially it was quite the ordeal.

Fetchmail

Fetchmail configuration was pretty straightforward.  That’s probably because I have done it before; but even where not, you really need to know only one thing in addition to the mailbox credentials: the syntax of the configuration file.

Check the files /etc/fetchmailrc or ~/.fetchmailrc (as root). There you probably will already find a line that looks like this:

poll "server.domain.com" protocol AUTO : user "john" there with password "pwd" is "smith" here ;

The only thing you need to watch out for is that the remote user and password match what you enter when you check email on the remote server. The here account ("smith" in the example) is the local user you would like email delivered to.

Once you have written the file, use cron to check for email on a regular basis. Check the man page, or simply follow these exact steps:

  1. type ‘crontab -e’
  2. type ‘i’ (for insert)
  3. type ‘* * * * * fetchmail’
  4. hit Escape
  5. type ‘:wq’

That’s five stars in the fetchmail line. If you are not familiar with UNIX, you probably have no idea what you just did, but that really doesn’t matter.

Add a Comment

Your email address will not be published. Required fields are marked *