Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I use fetchmail->procmail->mutt programms to all my mail. Some of mail generated automatically and some people not smart enough, so I would like to reformat mail body with some script.

My best guess is that I should do it with procmail. But I found no such rule, best thing I found is possibility to pipe mail to programm. Of course, I can resend it with flag that no futher formatting needed, but it does not look like right solution.

EDIT: Just discovered maildrop. Maybe, it is simpler to do my task with it?

share|improve this question
up vote 1 down vote accepted

It's not clear what sort of preprocessing you are looking for, but I'm guessing something like this.

| sed 's/\<grammer/grammar/g;s/definate/definite/g;s/sepera/separa/g'

If you want to edit headers such as Subject as well as the body, take out the bflag; but if your normalizations might change vital headers, perhaps you want to make it a bit more specific and/or robust.

share|improve this answer
Great! But I noticed, that my mail(utf-8 one) encoded with very long string of letters. I tried to just add text to end, but it do not work. So, I have to decode, format and code back. How can I decode? – KAction Nov 22 '12 at 10:55
There are various MIME encoding / decoding tools around. For quoted-printable, mimencode used to be helpful, but it's by and large obsolete. For base64, try the base64 encoder / decoder from a reasonably recent coreutils. If you are handy with a scripting language, there are MIME encoding and decoding libraries for Perl, Python, Lua, probably even TCL ... Maybe post a separate question with more details? See also – tripleee Nov 22 '12 at 10:58
Thanks! base64 do it's work – KAction Nov 22 '12 at 11:15

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.