Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using header_checks to change message-id header

4,477 views
Skip to first unread message

Jerico2day

unread,
Aug 15, 2011, 10:30:37 AM8/15/11
to
Hey all, I'm wondering how best I can change the message ID in the
header of emails. I use Zarafa 7x on an internal machine and I don't
believe there is a way to change the header easily with that software.

Here's an example from my email headers

Message-Id: <zarafa.4e46e3b1.34...@my.domain.com>

The problem is, is that "my.domain.com" is an internal server that
sends mail to a relay server. I don't want people really seeing my
internal domain or IP. I was able to change other parts of the header
to remove my local address using header_checks.

I'd like to have postfix dynamically change "my.domain.com" only on
Message-Id header to some arbitrary domain that would be
public-facing for all outgoing mail and change it back for incoming
mail.

Unfortunately, I'm not quite sure how to do that. I would appreciate
any assistance.

Thanks!

Noel Jones

unread,
Aug 15, 2011, 11:09:43 AM8/15/11
to


You can mangle an existing Message-ID with the REPLACE action just
like any other header.

Maybe your mail arrives without a message-id, so there isn't one
there to mangle. Postfix will insert a message-id if there isn't
one, and header_checks won't see the generated header.


-- Noel Jones

Peter Blair

unread,
Aug 15, 2011, 1:13:10 PM8/15/11
to
On Mon, Aug 15, 2011 at 10:30 AM, Jerico2day <jeric...@gmail.com> wrote:
> I'd like to have postfix dynamically change "my.domain.com" only on
> Message-Id header  to some arbitrary domain that would be
> public-facing for all outgoing mail and change it back for incoming
> mail.
>
> Unfortunately, I'm not quite sure how to do that. I would appreciate
> any assistance.

First in your main.cf:

header_checks = pcre:/etc/postfix/header_checks

Secondly in your /etc/postfix/header_checks:

/Message-Id:\s+<(.*?)@my.domain.com>/ REPLACE Message-Id: <$1...@my.domain.net>

Thirdly, test it:

$ postmap -q "Message-Id: <sdfsf...@my.domain.com>"
pcre:/etc/postfix/header_checks

> Thanks!

Note, ensure that your postfix installation supports pcre. My desktop
is debian, so I call:

$ apt-cache search postfix-pcre
postfix-pcre - PCRE map support for Postfix

Bastian Blank

unread,
Aug 20, 2011, 9:50:17 AM8/20/11
to
On Mon, Aug 15, 2011 at 09:30:37AM -0500, Jerico2day wrote:
> I'd like to have postfix dynamically change "my.domain.com" only on
> Message-Id header to some arbitrary domain that would be
> public-facing for all outgoing mail and change it back for incoming
> mail.

Care to explain how you intend to guarantee the uniqueness of the
message-ids?

Bastian

--
We Klingons believe as you do -- the sick should die. Only the strong
should live.
-- Kras, "Friday's Child", stardate 3497.2

in...@brokersolutions.it

unread,
Aug 28, 2012, 9:07:53 AM8/28/12
to
Thank's Peter, your string work perfect !!

stev...@gmail.com

unread,
Oct 24, 2016, 7:22:32 PM10/24/16
to
if anyone was looking like me for a catch all replace use this...

/Message-Id:\s+<(.*?)@.*?>/ REPLACE Message-Id: <$1...@Domain.tld>

azizer...@gmail.com

unread,
Dec 23, 2016, 10:31:33 AM12/23/16
to
Hello,

Should i replace (my.domain.com) with my own domain ??

Thanks.
0 new messages