I have Postfix + Dovecot + Mysql config, where I support multiple domains. The problem is when I add subdomain that already has main domain in virtual_mailbox_domains, Postfix rewrites it to main domain. For example: I send email as me@mail.example.com, Postfix rewrites it to me@example.com and send it as such. It works well for domains, but subdomains are rewritten to domains.
My example.com DNS setting: (spf details mocked, spf values are the same)
A @ 1.1.1.1
A mail 1.1.1.1
TXT mail._domainkey <value>
TXT mail2._domainkey <value>
MX @ example.com
MX mail mail.example.com
TXT @ v=spf1 a mx ip4:1.1.1.1 ip6:ffff::ffff:ffff:ffff:ffff ~all
TXT mail v=spf1 a mx ip4:1.1.1.1 ip6:ffff::ffff:ffff:ffff:ffff ~all
virtual_mailbox_domains
id | name
---|-----------------
1 | example.com
2 | mail.example.com
virtual_mailbox_maps
id | domain_id | pass | email
---------------------------------
1 | 1 | *** | support@example.com
2 | 2 | *** | newsletter@mail.example.com
virtual_alias_maps - empty
log:
...
Oct 24 01:29:44 mail postfix/smtpd[23898]: 216B9E32C5: client=dedicated-ail47.rev.name.com[1.1.1.1], sasl_method=LOGIN, sasl_username=newsletter@mail.example.com
Oct 24 01:29:44 mail postfix/cleanup[23901]: 216B9E32C5: message-id=<4afe4d8755119f7298f51e2586aa7f64@example.com>
Oct 24 01:29:44 mail opendkim[20747]: 216B9E32C5: DKIM-Signature field added (s=mail, d=example.com )
...
In OpenDKIM config domain and subdomain is configured separately.
How can I configure Postfix to not rewrite these addresses?