Hi,
I have a postfix server that relays to an exchange server. All of my unix/linux systems send to this server, the problem is the form the mail is sent with,
the sender address is
username@hostname.domain.local
I need to rewrite every sender address to
for this I added the following entry to main.cf:
sender_canonical_maps = hash:/etc/postfix/canonical
/etc/postfix/canonical:
/domain.local/ unix@maildomain.com
I ran the postmap command and restarted the mailserver
but it's not working, any idea?
--------------------------------------------------------------------
Edit: ok found the solution
in main.cf
sender_canonical_maps = regexp:/etc/postfix/canonical
instead of hash, works now
--------------------------------------------------------------------
Edit2: but just works for localhost, and not for relay hosts
-------------------------------------------------------------------
Edit3:
needed to append the line
local_header_rewrite_clients = static:all
to main.cf
hurray!!
------------------------------------------------------------------
Edit4:
hm now I need a solution, that writes the original hostname to the subject, because now I can't determine the sender host
of course it can be added to the specific mail script, but we have about 300 mailscripts
------------------------------------------------------------------
Edit5:
have the solution, regular expressions and header_checks, details tomorrow
..
to main.cf:
header_checks = regexp:/etc/postfix/header_checks
to /etc/postfix/header_checks:
/From:.* <.*@(.*)\.domain.local>/ REPLACE From: $1 <unix@maildomain.com>
this will not write the hostname to the subject, it writes it to the from field, looks like
From: hostname <unix@maildomain.com>
outlook displays this name in the from column, which is absolutely perfect for my needs