I use my linode server for pretty much everything. However, one of its main jobs is to house all of my email needs. I have several domains which receive personal email and that all collects on the server. For quite some time, I’ve used “fetchmail” to collect my work mail and deliver it via the local mail server. It would then be filtered and delivered to a 2nd Inbox. I had three total inboxes, one for my main account, a secondary for a backup account, and the third for my work email. The reason for the multiple mailboxes was to make it easier to setup email “profiles.” Using the console based mutt email client, I have setup folder rules. If I am in the work inbox, mutt will use specific settings that I use for work. Mainly reply to address, outgoing name, and signature.
In a nutshell, fetchmail is really a pain. It’s config file is really about the stupidest setup that I’ve ever seen, and all in all, it seemed like a lot of extra steps for something that really should be pretty simple.
Enter getmail. It is the same style program, but is much easier to install and doesn’t require a local server to filter and deliver mail. Instead, it can save to local folders using several different storage methods (mbox file, maildir, etc).
It was time to add another Inbox. This time, I needed to add one to Gmail. So, if you are looking to grab mail remotely from Gmail and store it somewhere, here is a quick and simple getmail config file that gets the job done:
[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = username@gmail.com
password = password
[destination]
type = Maildir
path = ~/.maildir/.Gmail/
[options]
delete = true
verbose = 0
message_log = ~/.getmail/gmail.log
If that is the only mail you want getmail to get, create a ~/.getmail directory and name the file getmailrc. However, getmail has the ability to gather mail from multiple locations using the –rcfile switch, i.e.:
getmail –rcfile ~/.getmail/getmailrc_gmail
Stick that in your crontab and you are off. Last, I just setup the Gmail folder in mutt, and it will periodically search that folder for new mail. For security’s sake, please make sure you chmod 600 everything in your ~/.getmail directory, or snoopy users can see your email passwords.