Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at

hpr3060 :: Running a local imap server

Ken installs courier-imap locally to have a local backup of his mail.

<< First, < Previous, , Latest >>

Thumbnail of Ken Fallon
Hosted by Ken Fallon on 2020-04-24 is flagged as Clean and is released under a CC-BY-SA license.
courier, imap, MailDir, raspberrypi. (Be the first).
The show is available on the Internet Archive at:

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:06:00


Setting up a local imap server

To install a local imap daemon that will only listen to localhost connections, made via ssh tunneling. This is for use as a local backup of your imap files, or for keeping a remote backup somewhere.

This is not a mail delivery solution but rather a way to keep a backup of your email using to a MailDir directory that you can access using your email client. As each message is stored in its own file, you can also use normal tools like find|sed|awk|grep to find messages.

This setup can be installed locally or remotely on, for example, a raspberry pi. In that case you can enable a portforwarding rule in ~/.ssh/config to include something like LocalForward

Install using aptitude install courier-imap courier-authdaemon

You can check the status using systemctl status courier-imap.service courier-authdaemon.service

Edit the file /etc/courier/imapd and modify the following settings:

Address to listen on, can be set to a single IP address.

    < ADDRESS=0
    > ADDRESS=

Maximum number of IMAP servers started


Maximum number of connections to accept from the same IP address

    < MAXPERIP=20
    > MAXPERIP=40

The following setting is optional, and causes messages from the given folder to be automatically deleted after the given number of days.

    > #IMAP_EMPTYTRASH=Trash:7

Change the directory name of the maildir directory.

    < MAILDIRPATH=Maildir
    > MAILDIRPATH=/home/pi/MailDir

Then restart the service using systemctl restart courier-imap.service courier-authdaemon.service.

When I did this I got a strange error about but installing the package gamin fixed it. Which is a Library providing the FAM File Alteration Monitor API.

  Filesystem notification initialization error -- contact your mail
  administrator (check for configuration errors with the FAM/Gamin library)


Subscribe to the comments RSS feed.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?