How I read and backup my mail
I was going to answer Stuart’s question to the Lazyweb in a quick comment, but I figured my email set up, while essentially not really special, is a bit peculiar and might be interesting to somebody out there.
I have all my personal email on Gmail, but I also download it locally to keep a backup, just in case. The problem is that if you read your mail with Thunderbird, it ends up inside a directory with a funny name which in turn contains a funny mix of files of which you don’t know the purpose, so the backup (and the restore) is a bit unpractical.
The solution turned out to be quite easy: you retrieve your email and with some magic symlinks you make Thunderbird read that. The only limitations to this are that Thunderbird only supports mbox mailboxes and that it has to update its indexes every time it starts.
My final set up is that I can retrieve, read and send email with both mutt and Thunderbird and the mail is in plain mbox files that I can easily rsync around. Here’s how I did it.
mutt downloads the mail and puts it in ~/Mail:
set pop_host = pops://micampe@pop.gmail.com:995
set pop_last = yes
set folder = ~/Mail
set spoolfile = +spool
set postponed = +postponed
set mbox = +inbox
set record = +inbox
set sendmail="~/.mutt/ssmtp"
You can see I also keep sent and received mail together, to emulate Gmail’s conversations, which I find very convenient.
To send mail (and this is my answer to Stuart), I use ssmtp, a very simple SMTP agent which is also flexible and easy to configure. It just connects to an external SMTP server and forwards my email to it. No queuing, no forwards, no nothing it just does that and here’s how I set it up:
mailhub=smtp.gmail.com:465
rewriteDomain=micampe.it
FromLineOverride=YES
UseTLS=YES
AuthUser=micampe@gmail.com
This is saved in ~/.mutt/ssmtp.conf and is used by the script ~/.mutt/ssmtp which mutt is using to send mail:
#!/bin/sh
/usr/sbin/ssmtp -C ~/.mutt/ssmtp.conf $@
One nice thing about ssmtp is that it’s just a command line program that you run when you want to send a mail, you don’t need to have a daemon running.
Now I just have configured mutt to read my mail from Gmail, “what’s the deal?” you say, “this is easy.” Well, the next step is where I symlink mutt’s inbox with Thunderbird’s:
$ cd ~/.mozilla-thunderbird/*.default/Mail/Local\ Folders/
$ rm Inbox
$ ln -s ~/Mail/inbox Inbox
Now mutt and Thunderbird have access to the same mail messages, and I can use which one I like best in a given moment.