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

[retriever]
type = SimplePOP3SSLRetriever
server = pop.myserver.com
username = username
password = Secret
delete_dup_msgids = True

[destination]
type = Maildir
user = mail
path = /share/MD0_DATA/mail/

[options]
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/crond.sh 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.

Leave a Reply

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