On Mon, Nov 06, 2023 at 11:55:44AM +0100, lejeczek via Postfix-users wrote:

> I'm thinking having each box's root I'd forward to _allmail@my.private_ -
> probably it's how many, if not everybody, do it.
> Here, my 'allmail' is a user which exists, via Dovecoto auth, on all boxes.
> What I struggle to wrap my head around, how, since I have:
> ...
> mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
> ...
> is, how to have Postfix mail to that one MX for this local 'my.private'
> domain.

The best-practice way to deliver mail addressed to one logical recipient
to two (or more) separate mailboxes is to use virtual(5) aliases:

    virtual:
        root  root@local.invalid, someuser@foo.example

This assumes:

    - Only "local.invalid" is listed in $mydestination
    - $myorigin is the same on all hosts, and expands to a shared
      logical mail domain.
    - Neither $myorigin, nor its expanded value, is listed in $mydestination
    - A relayhost is defined to point at the internal mailhub
      ("smarthost") which knows how to deliver for all valid addresses
      in the shared domain.

      main.cf:
        indexed = ${default_database_type}:${config_directory}/

        mydomain = foo.example
        myorigin = foo.example
        mydestination = local.invalid
        relayhost = [mail.foo.example]

        virtual_alias_maps = ${indexed}virtual
        alias_database = ${indexed}aliases
        alias_maps = $alias_database

        # Maildir delivery, see local(8)
        mail_spool_directory = /var/spool/mail/

        # Or
        # mailbox_transport = lmtp:unix:...

        # Or skip local aliases(5) entirely:
        # local_transport = lmtp:unix:...
        # local_transport = virtual (with suitable virtual_mailbox_maps,
        #                            virtual_uid_maps, ...)

      aliases:
        postmaster: root
        bin: root
        ...

Basically, use as little of the legacy Sendmail-compatible behaviour of
local(8) as you can:

    - Avoid 1-to-many aliases(5) expansion
    - Avoid delivery to command pipes
    - Avoid .forward files
    - ...

Use at most:

    - One-to-one delivery to a mailbox, or preferrably a maildir
    - Or better, just deliver directly to an LMTP server or via
      virtual(8).

The main useful feature of local(8) that is best exercised on the
mailhub is support for mailing lists via ":include:", owner-alias
mappings, ...  But you should not need this null client end hosts.

Speaking of "null clients", see also MULTI_INSTANCE_README.

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

Reply via email to