Sender address rewrite from internal to external domains (Zimbra 8.7)

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
User avatar
opsystem
Posts: 33
Joined: Mon Nov 20, 2017 6:32 pm

Sender address rewrite from internal to external domains (Zimbra 8.7)

Post by opsystem »

Hi all,

I’ve one of those situations where mailboxes are @localdomain and users should be able to send messages outside via external relay as, let’s say, externaluser@realdomain.com.

So the goal here is:
sender user@localdomain -> *anyuser*@localdomain ----> no rewrite
sender user@localdomain -> rest of the world ----> sender rewrite as externaluser@realdomain.com -> external relay

Postfix has a parameter for this: smtp_generic_maps (zimbraMtaSmtpGenericMaps), this works but problem is that senders are rewritten when recipients are internal too – and that's quite strange (as Postfix guide says "It does not happen when you send mail between addresses on the local machine").
Any suggestions?
Thanks

P.S. I'm already using Personas as external accounts, the issue here is when using internal accounts only.
AcidVenom
Posts: 1
Joined: Thu Mar 15, 2018 5:30 am

Re: Sender address rewrite from internal to external domains (Zimbra 8.7)

Post by AcidVenom »

Same situation. I think need a feature request.
User avatar
oetiker
Outstanding Member
Outstanding Member
Posts: 275
Joined: Fri Mar 07, 2014 1:05 pm
Location: Switzerland
ZCS/ZD Version: Release 10.0.6.GA.4518.UBUNTU20_64
Contact:

Re: Sender address rewrite from internal to external domains (Zimbra 8.7)

Post by oetiker »

hi

does this not work with a sender_canonical map. I could not found a who to about that but since zimbra is using postfix it should
be done by a sender_canonical_map

somthing like this https://wiki.zimbra.com/wiki/How_to_red ... o_one_user example just with an other map
on that page https://wiki.zimbra.com/wiki/Postconf_keys I found the key zimbraMtaSenderCanonicalMaps

Code: Select all

zmprov mcf zimbraMtaSenderCanonicalMaps 'pcre:/opt/zimbra/conf/postfix_sender_canonical'
cat /opt/zimbra/conf/postfix_sender_canonical

Code: Select all

@localdomain    @realdomain.com
has anybody done this?

cheers Manuel
gek
Posts: 3
Joined: Wed May 11, 2016 1:47 pm

Re: Sender address rewrite from internal to external domains (Zimbra 8.7)

Post by gek »

opsystem wrote:Hi all,

I’ve one of those situations where mailboxes are @localdomain and users should be able to send messages outside via external relay as, let’s say, externaluser@realdomain.com.

So the goal here is:
sender user@localdomain -> *anyuser*@localdomain ----> no rewrite
sender user@localdomain -> rest of the world ----> sender rewrite as externaluser@realdomain.com -> external relay

Postfix has a parameter for this: smtp_generic_maps (zimbraMtaSmtpGenericMaps), this works but problem is that senders are rewritten when recipients are internal too – and that's quite strange (as Postfix guide says "It does not happen when you send mail between addresses on the local machine").
Any suggestions?
Thanks

P.S. I'm already using Personas as external accounts, the issue here is when using internal accounts only.
Hello! Could you explain, before adding persona's external email, did you created domain alias for that external mail?
By your example:
you have user@localdomain mailbox -> but you need to send a message from user@realdomain -> do you create @realdomain alias to @localdomain ? Or just create a persona and allow user's persona send mail from user@realdomain in
"admin console-> edit the account (or COS)-> select the 'Preferences' tab -> Allow sending mail only from these addresses: " ?

OH, +1 to the topic question!

upd. i've found that solution. I think it's very similar to.
secathor
Posts: 1
Joined: Wed Oct 24, 2018 1:11 pm

Re: Sender address rewrite from internal to external domains (Zimbra 8.7)

Post by secathor »

oetiker wrote:hi

does this not work with a sender_canonical map. I could not found a who to about that but since zimbra is using postfix it should
be done by a sender_canonical_map

somthing like this https://wiki.zimbra.com/wiki/How_to_red ... o_one_user example just with an other map
on that page https://wiki.zimbra.com/wiki/Postconf_keys I found the key zimbraMtaSenderCanonicalMaps

Code: Select all

zmprov mcf zimbraMtaSenderCanonicalMaps 'pcre:/opt/zimbra/conf/postfix_sender_canonical'
cat /opt/zimbra/conf/postfix_sender_canonical

Code: Select all

@localdomain    @realdomain.com
has anybody done this?

cheers Manuel
Just a little information about this solution, the file /opt/zimbra/conf/postfix_sender_canonical need to be in regular expresion, like

Code: Select all

/^(.*@)localdomain$/     ${1}realdomain.com
Thank you
dac29
Posts: 5
Joined: Mon Jan 22, 2024 8:49 am

Re: Sender address rewrite from internal to external domains (Zimbra 8.7)

Post by dac29 »

Hi opsystem, did you resolve your issue? Is it a bug ? Thanks a lot !
Post Reply