I very successfully dealt with single line headers in pcre:/etc/postfix/header_check
. But when it comes to multi-lines, I'm a bit frustrated. Here is a part of header:
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Content-Type: multipart/alternative;
boundary="_000_8FA6C259529CB0418FBDF96A6B22A486209F15MAILmynetworkloca_"
MIME-Version: 1.0
--_000_8FA6C259529CB0418FBDF96A6B22A486209F15MAILmynetworkloca_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
test
--_000_8FA6C259529CB0418FBDF96A6B22A486209F15MAILmynetworkloca_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
And what I need, just to get rid of strings like
--_000_8FA6C259529CB0418FBDF96A6B22A486209F15MAILmynetworkloca_
Or at least replace last part MAILmynetworkloca_
to something like maildomaincom_
I've tried to put to my /etc/postfix/header_check
/MAILmynetworkloca_/ REPLACE maildomaincom_
but it didn't work
FYI: The line
--__INSERTSOMERANDOCHARHERE000MAILmynetwok
isn't part of email headers. And maybe you don't wanna to alter/remove it.Anyway, here to do it.
You should use both
header_checks
andbody_checks
to replace those line.Content of
main.cf
Content of
/etc/postfix/mimereplace
I think you'll want to use something like
/MAILmynetworkloca_$/m REPLACE maildomaincom_
.The dollar sign means at the end of the string, the
m
should put it in multiline mode (according to the PCRE pages)Why you'd want to replace that header I don't know, but it's your mail server :)