Email back up on Qnap using getmail

Email backup to qnap using getmail proved to be so easy and efficient that I am not touch anything else. The reason i started looking was to be able to use Maildir. I was interested in Maildir format for a reason. Every email is stored as a different file, so incremental backup is very easy and there are no nasty file locks that may corrupt your mbox. I am scared of storing all the mails in a single mailbox and see it grow, and eventually get corrupt.

Started with the idea of downloading mails on Qnap using getmail, and then read them using a mail client that can read maildir format. additionally, mu0 mail searching looks very good too, so probably the next thing I will do is try installing it , so the email searching becomes easy.

Part A)  Configuring Getmail.

You can download getmail as an ipkg. If your qnap doesn’t have ipkg support, install the optware package manager from app store first.

Once installed, create a directory to hold your emails and create a user that has access to this directory. You can’t run getmail as root. Since I used Maildir format, i had to create 3 subdirectories called cur,new , tmp as getmail expects them to be there.

The configuration file stays in /root/.getmail/  as getmailrc

My configuration for getmailrc is

type = SimplePOP3SSLRetriever
server =
username = username
password = Secret
delete_dup_msgids = True

type = Maildir
user = mail
path = /share/MD0_DATA/mail/

verbose = 2
message_log = /share/MD0_DATA/Public/email.log
delete = True

you can run getmail at the command prompt without any arguments to see if it works.

Now you can add entry to crontab for scheduling a run of getmail

Add your entry to  /etc/config/crontab. ( 0 */5 * * * getmail)
Run crontab /etc/config/crontab
Restart cron, i.e. ‘/etc/init.d/ restart’

Part B) Reading your emails.

There are many  ways to read your emails . One is installing mutt ( text email client) on qnap itself for quick access to mails.  Second is installing a webmail like squirrelmail and let it read from maildir, and third is using evolution graphics interface.

I opted for evlution being easiest. You just have to create a new account as maildir account in evolution and specify your maildir directory. Offcours evolution can’t run on Qnap, you have to have a physical ( or virtual) machine running evolution , reading from your maildir.

2 thoughts on “Email back up on Qnap using getmail”

  1. Hi,

    Please could you share a getmail installation procedure or something similar.
    I have a qnap server but cant find a way to achieve the installation.

    Best regards

    1. Hello,
      now qnap has a very easy to use package called qmailagent with a very nice GUI and it does store each email in a different file. This is the easiest option.

      Earlier when I used getmail, I used a package called optware first. I don’t think it exists in Qnap’s app store anymore. With Optware, you get access to thousands of ipkg apps.

      With newer Qnaps, I would suggest either installing Qmailagent, or using a full linux virtual machine ( if yours has a Virtual station)

Comments are closed.