Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I go about parsing new message subject lines non-interactively using Mutt?

Mutt is already configured and fetches mail from our Exchange server.

What I'd like is for an action to be triggered when a message arrives in my inbox with a certain subject line.

And this would have to be non-interactive, as it is for scripting purposes.

Any and all help is appreciated. I have Googled extensively but to no avail.

Thank you!

share|improve this question
up vote 4 down vote accepted

Is is critical that it's mutt that does this? Performing actions when email arrives (that matches certain criteria) is otherwise precisely what procmail is for.

Here is a guide that shows you how to use fetchmail in conjunction with procmail to do filtering of emails that come from a remote mailbox:

Please disregard this answer is using mutt is essential.

share|improve this answer
Well.. embarrassment The reason why I'm using Mutt is because it's the only client I found that I had no trouble configuring.. I'll try with fetchmail using the article you linked to. – SirCharlo Feb 17 '12 at 14:16
In that case, I think you will find procmail to be the perfect tool to use. :-) When you want to figure out how do do things with procmail, searching for "procmail recipes" will most likely help you do everything you could ever want to do with email. – Lakritsbollar Feb 17 '12 at 14:20
Thanks! Your answer turned out to be exactly what I needed :) – SirCharlo Feb 18 '12 at 5:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.