On Thu, May 29, 2025 at 07:46:20PM +0200, Matus UHLAR - fantomas via 
Postfix-users wrote:

> Our customer reported that they started migrating users to 365 services
> (yeah, after they started).
> 
> Of course, this means that they are unable to send mail from local
> system to addresses in local domain that are created in 365.
> 
> 
> I added t...@example.com to local_recipient_maps so the address is accepted,
> successfully.
> 
> I tried to use fallback_transport and/or fallback_transport_maps to ensure
> all mail with non-existing local users is forwarded to remote destination:
> 
> t...@example.com relay:[example-com.mail.protection.outlook.com]
> 
> but the local delivery agent complains about unknown user:
> 
> May 29 18:46:09 mail postfix/local[2207]: 4b7XLn4zwqzKsZS:  
> to=<t...@example.com>, relay=local, delay=0.16, delays=0.06/0.01/0/0.09, 
> dsn=5.1.1, status=bounced (unknown user:  "test")
> 

Personally, I would flip this configuration around, and treat the domain
as a relay domain by default, rewriting the *known* local users to an
internal form that is passed to the local(8) delivery agent (if that's
how mail delivery happens, though I'd usually go with virtual mailboxes
via LMTP or virtual(8)).

    main.cf:
        myorigin = $mydomain
        relay_domains = some.example
        # Specify actual list, if known.
        relay_recipient_maps =

        transport_maps = inline:{ {local.invalid = local} }
        indexed = ${default_database_type}:${config_directory}/
        virtual_alias_maps = ${indexed}valias

        # Avoid automatic relay subdomains, if desired, add: smtpd_access_maps
        #
        parent_domain_matches_subdomains =

        # Empty $mydestination, all local(8) delivery is via virtual aliases!
        #
        # Note however, that when $myorigin is not listed in $mydestination,
        # unqualified addresses in the RHS of local aliases(5) are no
        # longer "local" recipients, so may need to be qualified with
        # a domain that does resolve to the local(8) transport.
        #
        #   local-alias: user1@local.invalid, user2@local.invalid
        #
        # However, this is only necessary when there are potential
        # "loops" in the alias "graph" with "A" forwarding (perhaps
        # indirectly) to "B" and "B" back to "A".  Also I strongly
        # recommend managing aliases in virtual(5) and using aliases(5)
        # only for ":include:/list/file", "owner-alias" or similarly
        # "special" mechanisms that can't be handled via virtual(5).
        #
        mydestination =

        # All local recipients are listed in virtual(5), the local
        # recipient table is defined, but effectively empty.
        #
        local_recipient_maps = inline:{ {@ = not a lookup key} }

    valias:
        # Known local recipients and aliases
        moe@some.example      moe@local.invalid
        larry@some.example    joe@local.invalid
        curly@some.example    curly@local.invalid
        everyone@some.example all-some.example@local.invalid
        ...

    aliases:
        owner-all-some.example: postmaster@some.example
        all-some.example: :include:/var/db/all-some.example

-- 
    Viktor.
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to