Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR3060: Running a local imap server

Hosted by Ken Fallon on 2020-04-24 00:00:00
Download or Listen

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 127.0.0.1:2143 127.0.0.1:143

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=127.0.0.1

Maximum number of IMAP servers started

    < MAXDAEMONS=40
    > MAXDAEMONS=80

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
    > #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)

Comments


Ken Fallon says: Very suspicious comment.

RE: hpr3060::2020-04-24 Running a local imap server by Ken Fallon
00:06:00 Listen in ogg, spx, or mp3 format.
Hi Somebdy

Thanks for your comment.

Exactly what a spammer would say ;-)

As you point out, all comments are moderated. All links are checked by humans. We strip out all html. If any spammers are checking us out, then feel free to a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Somebdy says: Nothing in particular

RE: hpr3060::2020-04-24 Running a local imap server by Ken Fallon
00:06:00 Listen in ogg, spx, or mp3 format.
This comment has nothing to do with the content. But after reading the lengths you go to keep this section spam free, I really wanted to appreciate the effort that goes into this. This is a great website, very grateful to have access like this for free and without ads and trackers. May you live long!


More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.