(Good!!!) Imapfilter + offlineimap + msmtp + mutt + abook = Email

Source: Internet
Author: User
Tags aliases gpg imap lua all mail

Original Article URL:


So, I ' ve spent a little over a week setting up my new email consumption/creation system. As you can the "the title of this" blog post, there are a few parts to it. Why would I do something crazy like edit config files for 4 different apps the to read and write email? OK, I wasn ' t happy with Thunderbird (yes, I'll ' ll try 3.0 when it hits the repos) and Evolution wasn ' t on all what I wanted . I do have gmail so why does just stick with the Web interface? Because I am wanting to does more self-hosted solutions for Web apps. Also, since I have more than one account, I want different messages to be sorted different and archived differently.

In Thunderbird I had a extension that allowed me to press "Y" and "the" "would" to the Gmail Al L Mail folder. This is great but it only supported one account. If I am reading my work emails in Thunderbird (which are also hosted by Gmail) and I hit "Y" the message would go Sonal Gmail account ' s all Mail folder, not the work account one. Not good (and a dumb limitation).

So, what e-mail program allows you to have complete control over those types of settings? Mutt. And yes, (Al) Pine also. But, I have friends to me-who-use mutt so exchanging files and muttrc are such and we can easier in person to s Hare tips.

What I want to does with this blog post, though, is isn't convince you ' Mutt is ' the best solution for you. I do want to, however, share what I did to set everything up for use with Mutt. In fact, the rest of the pieces of this setup can work equally the as-is and some like Alpine or even.

(since it is a long post, I didn ' t want to spam your reader, click for the rest of it)

Imapfilter does just what the name implies:it filters email on IMAP servers. The have Imapfilter running via a cron job on some always-on computer. It is then run every 3-5 minutes, connects to any number of IMAP servers, and filters the email. And the filtering doesn ' t even need to happen only in the INBOX (like Gmail) but can is for any mailbox. Eg:if you have a ubuntubugs folder can have all new Launchpad emails to go there, then if you have read them it could Then filter them to your Archive folder (or whatever).

Anyway, this is my Imapfilter.config.lua file. It is written in the Lua programming language which are simple to read.

Again, another Straight-forward software name (L Love software This is named what it does, kind of like kitchen appliances : Blender, toaster, refrigerator). Offlineimap'll connect to an IMAP server and download all (or some, can decide) of the messages to a local directory In Maildir format. It is very robust and quick; Syncs take very little time. This app are actually only run once (for you can do a gnome-session, run it manually, or with an init script) and it syncs every Ten (or 5, or whatever you want) minutes automatically.

This was great for a number of reasons. Always have an up-to-date backup to all your email on a local drive. Should your mail server die one night you to still be OK. Second, it effectively batches I email for me since I have it sync every. So every minutes is the most often I'll get new email. Great for Non-interruption.

The syntax is pretty simple too. This is my. offlineimaprc file. It checks one of Gmail account and one other IMAP account. Here are a fully commented config file with every option.

MSMTP is a simpler alternative to sendmail. It sends mail. Mutt is a MUA (mail User agent) not a MTA (mail Transpot Agent) and as such does not send email; You are have to the set up something else to does it for Mutt. This isn ' t is bad, really (Ed:it is the hardest part for Greg, don ' t let him fool you). Although, I did have a problem with MSMTP does being able to connect to my hosting provider ' s SMTP server via port 25. Getting around that required a quick SSH tunnel script (and a bit of the sanity checking from Asheesh, again!).

This is msmtp config file. And the accompanying SSH tunnel script so sending via port. The script simply stands in for msmtp and opens the tunnel, then the sends to arguments.

Mutt has the most complex config file, but luckily there are a ton of examples out there and you can fairly easily Ste certain sections (like colors). My muttrc has two sub files (which are sourced into muttrc): Crypto (for GPG) and muttmailboxes (for my list of mailboxes). Separated out mainly for readability. I might later separate out my colors section, macros, formating, etc. No practical need to, yet.

Question about GPG and mutt:i only [two options (so I must to be blind): either A) sign all mail you send or B) only sign Mail this is a reply to a signed email. That's leaves out a big use-case of:sign I want to sign. What am I missing?

Some points of interest with I muttrc:the Folder Hooks section. That allows your to set variables based on which folder for you are in (which account for you are reading mail in). This is useful the for me when I have ' Y ' set to archive a message. In Gmail, the "message" goes to gmail/archive, in my personal domain account it goes to grossmeier/archive. Also, that's where you set which "persona" your send mail from. It ' ll make sense as you'll be in the it in my config.

Also, I am using mutt-patched from Debian/ubuntu. This mainly adds a patch to have a side bar with the list of mailboxes (and associated all/unread/new). Pretty useful. Thus, there are a few settings in I muttrc for that specifically and wouldn ' t work with a non-patched Mutt.

Without further ado, my muttrc.

Oh Yes, an address book. Mutt has "aliases" that can be set up in a. mutt-alias file. Abook helps with the managing of that file. It also can convert your LDIF Thunderbird mailbox into a Mutt-alias file. You can click My settings for abook/aliases in my muttrc file on the top, the last four lines of "Basic Setup."

Thats it. That's all it took to have email just the way I want it. I have all of these files version controlled via BZR and pushed to a globally (authorization controlled) accessible Repositor Y I can share them between my desktop and laptop.

All the Files:imapfilter.config.lua OFFLINEIMAPRC MSMTPRC smtpforward.sh muttrc Crypto muttmailboxes

Any other tips for how do you have any of these applications? Anything you would the change with my setup? Leave a comment.

(potentially) related posts: Searching your email New laptop:setting up email me daily backup "script" Another "script" I use the Daily

Posted by Greg in 1:25 pm on January 25th, 2009. Comments ... »
Categories:uncategorized. Tags:freedom, news, sharing, Ubuntu. comments.

Mutt has had built in SMTP for a while now. Check out mutt-v for compile options.

Posted by Donnie Pennington on January 26th, 2009.

@Donnie: Yeah, I guess it does:)

Oh So, if I erroneously setup msmtp that isn ' t a big deal. The hardest part is working around the port block and which would have been true either way.

Posted by Greg on January 26th, 2009.

So does Offlineimap mark an email as read once it copies it? If not then can read a email in mutt and then go to GMail and it shows as unread.

Posted by Etank on January 28th, 2009.

Offineimap downloads the email in whatever state it's in to the IMAP server (so in this case "unread"). Then, in my case, mutt'll read it and mark the copy on my harddrive as read. Then, when Offlineimap syncs with the IMAP server It marks the copy on the server as read.

Posted by Greg on January 28th, 2009.

For this, really useful!

I had a bit of a problem with the OFFLINEIMAPRC which I copied to as it didn ' t like the inline-like:
AutoRefresh = # minutes until next sync

It seems fine if the whole line are a comment though, like:
# GMAIL Account Settings #

Hope that ' s of the use to anyone setting this up!


Posted by John Lawrence on March 24th, 2009.

@John: for the comment. I actually added those comments in only for the "version I put online" (Iow:it was untested). I just checked the version I have running myself and it does not included those inline.

My bad:)

Posted by Greg on March 24th, 2009.

Great post, thank for sharing.
I would replace the "$ $ $ $ $ $ $ $ $ $ $ $ $9″list in smtpforward.sh with $@ Y arguments is there (just in case).

Posted by redshift on March 26th, 2009.

Hey Greg–thanks for the article. I am able to get up and running with Mutt, Offlineimap, MSMTP, and abook across multiple Gmail.

Much appreciated!

Posted by Adam Bair on August 11th, 2009.

Great article. Looks a lot like my setup. One thing you should consider to complete your workflow are msmtp-enqueue so you can "send" emails from Mutt even if ' re Offline.

Posted by Jojo on November 18th, 2009.

@Jojo: Great idea. I am actually just thinking about how I am going to set up that functionality. Hadn ' t got to the google-searching part of the process so you just saved me some time! thanks!

Posted by Greg on November 18th, 2009.

[...] My email configuration addiction continues. As you may recall, I did a extensive (now out-dated) post about my email setup. I ' m still using the basic configuration outlined there (all of the same [...]

Posted by Consilience-new laptop:setting up Email on January 28th, 2010.

Saved me a bunch of hours configuring Imapfilter. thanks!

Posted by Prashant Borole on April 10th, 2010.

[...] Spent quite a bit of yesterday and today fiddling around with some things this my buddy Greg posted about a month ago. I have had Mutt doing the generic IMAP thing with GMail and it works fairly. The [...]

Posted by who has the perfect IMAP setup? -Richard A. Johnson ' s Blog on February 12th, 2011.

[...] I mean the "suite of tools" bring email sent to me eyes. I ' ve written before on the My setup (Note:that are out of date today) and its migration across systems. As you can, I ' m a fan [...]

Posted by consilience-searching your e-mail on January 5th, 2012.

Hi, do your know any way to invoke Imapfilter everytime a new Mail arrives in Mutt? Exist there any hooks or something similar to it?

Posted by Paloran on April 17th, 2012.

Hi Paloran,

I don ' t but there might be a way. I just have offlineimap call Imapfilter before it syncs. So if you are offlineimap, do it that way. If you don ' t use Offlineimap I ' m at a loss right now. I ' m sure if it is possible via a Mutt config option there are a guide out there somewhere:)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.