Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


hpr3060 :: Running a local imap server

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

<< First, < Previous, Latest >>

Host Image
Hosted by Ken Fallon on 2020-04-24 is flagged as Clean and is released under a CC-BY-SA license.
Tags: courier, imap, MailDir, raspberrypi.
Listen in ogg, spx, or mp3 format. | Comments (0)

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

Subscribe to the comments RSS feed.

<< First, < Previous, Latest >>

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:
Title:
Comment:
Anti Spam Question: What does the P in HPR stand for ?
Are you a spammer →
Who hosted this show →
What does HPR mean to you ?