Preprocessing incoming mail with fetchmail/procmail/mutt

0

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?

KAction

Posted 2012-11-21T18:36:58.593

Reputation: 281

Answers

1

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

:0fbw
| 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.

tripleee

Posted 2012-11-21T18:36:58.593

Reputation: 2 480

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 – 2012-11-22T10:55:55.590

1

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 http://www.polarhome.com:793/~gustedt/normail.html

– tripleee – 2012-11-22T10:58:42.353