mhrw 0.8.1 review

Download
by rbytes.net on

mhrw is a tool for mailheader manipulation

License: GPL (GNU General Public License)
File size: 295K
Developer: Stephan Seitz
0 stars award from rbytes.net

mhrw is a tool for mailheader manipulation. mhrw can be useful in complex MTA setups. In general, headers shouldn't be rewritten, but i found myself configuring an MTA with special delivery methods, where delivery took place depending on spamassassin's spam-level and various other things.

In this setup, smtpd and delivery were completely different tasks without any communication possible between them. So, i decided to use the mail-headers loading some additional neccessary information. To get rid of lots of slow scripts, mhrw was born.

How it works:

mhrw reads mails from < stdin > or (if argument is given) from < file >. It supports two 'operating modes',

a) replace some part of the header, matched by a regular expression,
b) add some part to the header below the former last headerline.

In no way the body of a message is touched. Anything below the header is passed through. Also, the message will always pass until EOF.

Examples:

To show some example, on how to use mhrw, i'll define the following (not
really standard, but very simple) mail as origin:

Received: somehost (somehost.somewhere) by uid 1007 with esmtp
X-Authenticated-SMTP: username
Received: anyhost; date
Subject: some test

body
...

If this mailalike header is getting used by following command:

mhrw '^X-Authenticated-SMTP: .*$' ''

this will result in:

Received: somehost (somehost.somewhere) by uid 1007 with esmtp
Received: anyhost; date
Subject: some test

body
...

You're able to use any regular expression you like, limited (by default) upto 4 subqueries.

The second argument (the replacement string) interprets written n and r sequences.

Installation:

mhrw dosn't relay on libraries and is written with a very basic set of commands, so:

./configure
make
make install

should build the binary on most platforms.

mhrw 0.8.1 search tags