Hello,

We are using postfix 3.5.25-0+deb11u1 to host many virtual domains.
Recently one domain was migrated to M365, so we removed it from the
transport table, but aliases definitions were still there.
We have noticed that in this case postfix was rewriting the recipient
email address based on our aliases even when delivering to M365.

48995E307: to=<[email protected]>, orig_to=<[email protected]>,
relay=example-com.mail.protection.outlook.com[52.101.68.27]:25

Where is the mistake in our config (very old one, adjusted multiple
times over the last 10 years)?
I include it even with my maybe wrong comments accumulated over the years:

local_recipient_maps    = $alias_maps, $virtual_mailbox_maps,
proxy:unix:passwd.byname

# since postfix 2.0: You no longer need to specify all the virtual(8)
mailbox domains in the Postfix transport map.
# NEVER list a virtual MAILBOX domain name as a virtual ALIAS domain!
# virtual_alias_maps works for every email (even local), no need to
specify alias_domains
virtual_alias_maps      = hash:/etc/postfix/virt_alias,
proxy:mysql:/etc/postfix/mysql/mysql-virtual.cf
virtual_alias_domains   =

virtual_mailbox_maps    = proxy:mysql:/etc/postfix/mysql/mysql-virtual-maps.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/mysql-transport.cf

virtual_transport       = dovecot
dovecot_destination_recipient_limit = 1
enable_original_recipient = yes


# each domain we host has destination="virtual:"
mysql-transport.cf:query        = SELECT destination FROM
email_transport e JOIN domain d ON e.domain_id = d.id JOIN
hosting_server s ON d.mail_server = s.id WHERE e.domain='%s' AND
s.servername='kenny'

# email_users contains mailboxes, mailbox location, ...
mysql-virtual-maps.cf:query             = SELECT maildir FROM
email_users e JOIN domain d ON e.domain_id = d.id JOIN hosting_server
s ON d.mail_server = s.id WHERE e.email='%s' AND s.servername='kenny'

# used for aliases and redirects on the hosted domains
mysql-virtual.cf:query          = SELECT vd.email as destination FROM
email_virtual v JOIN email_virtual_destination vd ON v.id =
vd.email_virtual_id JOIN domain d ON v.domain_id = d.id JOIN
hosting_server s ON d.mail_server = s.id WHERE v.email='%s' AND
s.servername='kenny'

### /etc/postfix/virt_alias
#   alias postmaster@every_virt_domain to local user "mail" (mbox in /var/mail)
postmaster:     mail


I now see maybe 2 issues:

1) What happens when virtual_alias_domains is empty? (It is also empty
in the output of postconf.) To which domains is virtual_alias_maps
applied in this case? I have a comment that "virtual alias" should not
be mixed with "virtual mailbox". In that case, where should the
aliases (like alias@xx to user2@xx or redirect like alias@xx to
abc@remote-yy) be defined?

2) Does $virtual_mailbox_maps in local_recipient_maps have any purpose?

Which part of my config causes the aliases to be applied also to a
remote domain?

Thanks!

-- 
  bye, Marki
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to