Gmail, offlineimap, msmtp, and mutt for command line email

mutt.png

Collecting bits and pieces over the past year, I’ve come up with the perfect solution for email on the command line.   Enjoy.

mkdir ~/Mail (if you want this to be different change the “localfolders” line in .offlineimaprc )

here, the following are my configs. All of these will have to be editted with your email address and/or password. I’ve noted email address goes where xxxxx@gmail.com is specified. .msmtprc isn’t commented out and should be easy enough to figure out.

.muttrc

.mstmprc

.offlineimaprc

mailget (save this to ~/bin and make executable with a chmod u+x )

I find it’s nice to have a cronjob run that checks to see if offlineimap is running and if not to start it. If you crontab -e and insert this line and :wq, you should be good.

 */3 * * * * /home/<username>/bin/mailget
 * 5 * * * /usr/bin/pkill offlineimap

And after this just set your window manager or Desktop environment to autostart offlineimap upon logging in and you should be good to go.

If you want to view html emails in elinks automatically and have attachments open in various applications you have to setup a ~/.mailcap file (and have elinks installed). here’s mine:

.mailcap

There’s a lot more stuff here:

http://tuxtraining.com/tag/mutt

Related Posts

Comments are closed.