Managing Domains
Creating a Domain Alias
If you have a domain domain.com and you want the domain example.com to be an alias for it, so that sending mail to user@example.com is the same as sending mail to user@domain.com (delivered to the same mailbox), you can designate example.com as a domain alias when creating the domain. This example assumes domain.com already exists, but example.com does not.
Prior to ZCS 5.0.16
zmprov cd example.com zimbraDomainType alias zimbraMailCatchAllAddress @example.com zimbraMailCatchAllForwardingAddress @domain.com
ZCS 5.0.16 and later, a new create an alias domain command is available
zmprov createAliasDomain {alias-domain-name} {local-domain-name|id} [attr1 value1 [attr2 value2...]]
Relaying/Domain Forwarding
If you want the Zimbra server to relay all mail destined for a particular domain (say, example.com) to another mta (say, other-mta.domain.com), you can forward the domain.
zmprov md example.com zimbraMailCatchAllAddress @example.com md example.com zimbraMailCatchAllForwardingAddress @example.com md example.com zimbraMailTransport smtp:other-mta.domain.com
I think you can also do this as another way to make a sort of local domain alias:
zmprov md example.com zimbraMailCatchAllAddress @example.com md example.com zimbraMailCatchAllForwardingAddress @domain.com md example.com zimbraMailTransport lmtp:zimbra.domain.com
For non-zimbra domains, this might prove useful as well: Transport_Table_for_external_servers
Domain Catchall
If you want to set up an account "user@domain.com" to catch any mail not delivered to existing users in the domain "domain.com", you can configure the account as a domain catchall.
su - zimbra zmprov modifyAccount user@domain.com zimbraMailCatchAllAddress @domain.com
If the users "john@domain.com", "webmaster@domain.com", and "xyznobody@domain.com" don't exist, and mail arrives for them, it will be delivered to the catchall account "user@domain.com". This will increase the amount of spam delivered, and can lead to being blacklisted. To remove the catchall from an email account, unset the catchall address:
zmprov modifyAccount user@domain.com zimbraMailCatchallAddress ""
Domain Masquerading
If you want mail from user@domain.com or user@zimbra.domain.com to appear to come from user@example.com, you can set the canonical address for the entire domain.
zmprov md domain.com zimbraMailCatchAllAddress @domain.com zimbraMailCatchAllCanonicalAddress @example.com zmprov md zimbra.domain.com zimbraMailCatchAllAddress @zimbra.domain.com zimbraMailCatchAllCanonicalAddress @example.com
Additional
out of office notifications=
5.0.12+ allows some additional mapping of real to alias in order to:
A) Allow auth with alias domain addresses.
B) Send out-of-office notifications for alias domains.
zmprov md aliasdomain.com zimbraDomainAliasTargetId {zimbraId-realdomain.com}
single command
5.0.16+ added the ability to do this (above) in one command:
zmprov createAliasDomain(cad) {alias-domain-name} {local-domain-name|id} [attr1 value1 [attr2 value2...]]
cad sets zimbraDomainType, zimbraDomainAliasTargetId, & zimbraMailCatchAllAddress
(if you want to forward mails from aliasdomain.com to realdomain.com you need to add zimbraMailCatchAllForwardingAddress)
zmprov cad aliasdomain.com realdomain.com zimbraMailCatchAllForwardingAddress @realdomain.com
Email to non-existant accounts=
Currently we automatically accept email for alias domains and then generate a bounce. This has the potential for backscatter abuse and we'd like to close this hole for hosed and still be able to offer alias domains without adding aliases to each account.
/opt/zimbra/conf/zmmta.cf smtpd_reject_unlisted_recipients 'yes' won't work with alias domains, so it's defaulted to no. (Perhaps later we'll flip this.)
However, 5.0.12+ contains a Policyd Daemon that helps those who host alias domains in ZCS.
To enable the policy daemon:
zmlocalconfig -e postfix_enable_smtpd_policyd=yes postfix stop postfix start