Discussion:
sender address/domain rewrite problem
(too old to reply)
c***@gmail.com
2013-04-03 15:57:21 UTC
Permalink
Hi there,

I'm trying to rewrite sender address/domain from @sub.example-domain.com to @example-domain.com.

I tried:
1) masquerade_domains = example-domain.com
2) sender_canonical_maps=hash:/etc/postfix/sender_canonical
(sender_canonical: @sub.example-domain.com to @example-domain.com)


In both cases, with masquerade_domains and sender_canonical_maps, when I send a mail from ***@sub.example-domain.com, I recieve mail with:
- Return-Path: ***@example-domain.com
- From: Username <***@sub.example-domain.com>

Is there some way to rewrite "From: " part of msg header?
- From "From: Username <***@sub.example-domain.com>" to "From: Username <***@example-domain.com>" ??

--
Zoran
Gabriele
2013-04-16 05:54:10 UTC
Permalink
Post by c***@gmail.com
Is there some way to rewrite "From: " part of msg header?
In main.cf:

header_checks = pcre:/etc/postfix/header_checks

(use regex if your postfix does not support pcre)

Then, add the following line to the header_checks file:

/^From: Username <***@sub\.(example-domain\.com)>/ REPLACE From: Username <user@{1}>

Restart postfix
--
Gabriele
Loading...