On Mon, Mar 23, 2026 at 11:00:53AM +0000, Sad Clouds via Postfix-users wrote:

> I'm trying to better understand the use cases for relay_domains vs
> virtual_mailbox_domains.

Per ADDRESS_CLASS_README, the essential difference between the various
address classes is:

    - How recipient validation is performed.
    - Which transport is selected by default for valid
      recipients.
    - The selected transport then determines Which deliveries are
      considered to be "final" deliveries, this may affect DSN
      processing, see for example the documentation of the obsolete
      "lmtp_assume_final" (since superseded by 'flags=X' in master.cf,
      see "COMMAND ATTRIBUTE SYNTAX" in lmtp(8)).

Therefore, if the same table of valid recipients is used to validate a
set of recipients matching "relay_domains" addresses, as might instead
be used to validate recipients matching "virtual_mailbox_domains", AND
after that the same transport:nexthop is specified as either
"relay_transport" or "virtual_transport" then there's mostly no
difference.

> Currently I have this configurations:
> 
> main.cf:
> relay_domains  = hash:/etc/postfix/relay_domains
> transport_maps = hash:/etc/postfix/transport_maps, $relay_domains

The residual difference is that with relay_domains Postfix defaults
to also accepting (subject to relay_recipient_maps, ...) also recipients
in subdomains of relay_domains.  That's not the case with virtual
mailbox domains.  You can control this via (mnemonic pmds):

    https://www.postfix.org/postconf.5.html#parent_domain_matches_subdomains

You might consider setting it empty (BCP) or at most perhaps:

    parent_domain_matches_subdomains = smtpd_access_maps

regardless of which address class you choose.

> Some Dovecot documentation suggests using virtual_mailbox_domains like
> this:
> 
> main.cf:
> virtual_mailbox_domains = example.com
> virtual_alias_maps      = hash:/etc/postfix/virtual
> virtual_transport       = lmtp:unix:private/dovecot-lmtp

You would take that advice (but replace "hash" with "cdb" or "lmdb").
Mailbox delivery via LMTP is not SMTP relaying to another domain
for subsequent additional store and forward processing.

> So what would be the advantage of virtual_mailbox_domains instead of
> relay_domains?

Clarity.

-- 
    Viktor.  🇺🇦 Слава Україні!
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to