Hello Viktor,

thanks for the explanations.

When creating the e-mail using

echo “Test email (virtual domain)” | /usr/sbin/sendmail root

Is not taken into account in the subsequent configuration of virtual domains /etc/aliases:

virtual_mailbox_domains = lmdb:/etc/postfix/virtual_mailbox_domains_maps,
        proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = lmdb:/etc/postfix/virtual_mailbox_maps,
        proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
virtual_alias_domains = lmdb:/etc/postfix/virtual_alias_domains_maps
virtual_alias_maps = lmdb:/etc/postfix/virtual_alias_maps,
        proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf,
        proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf,
proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_transport = lmtp:inet:dovecot.tachtler.net:24

In this example, all lmdb are empty (but prepared), but converted to lmdb format with postmap - but there is no evaluation of /etc/aliases.


-----

Apr 21 06:16:06 server postfix/pickup[1076]: 619E4180084: uid=0 from=<root>
Apr 21 06:16:06 server postfix/cleanup[1146]: 619E4180084: message-id=<20250421041606.619e4180...@mx1.tachtler.net> Apr 21 06:16:06 server postfix/qmgr[1078]: 619E4180084: from=<r...@postfix.idmz.tachtler.net>, size=287, nrcpt=1 (queue active) Apr 21 06:16:06 server postfix/lmtp[1154]: Verified TLS connection established to dovecot.tachtler.net[fd00::10:10:0:0:80]:24: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256 Apr 21 06:16:06 server postfix/lmtp[1154]: 619E4180084: to=<r...@tachtler.net>, orig_to=<root>, relay=dovecot.tachtler.net[fd00::10:10:0:0:80]:24, delay=0.17, delays=0.06/0.04/0.03/0.04, dsn=2.0.0, status=sent (250 2.0.0 <r...@tachtler.net> Od6tMYXGBWj4AwAAhuu2+w Saved)
Apr 21 06:16:06 server postfix/qmgr[1078]: 619E4180084: removed

-----


Thanks and regards
Klaus.


On 4/20/25 09:18, Viktor Dukhovni via Postfix-users wrote:
On Sun, Apr 20, 2025 at 09:02:43AM +0200, Klaus Tachtler via Postfix-users 
wrote:

I have a question of understanding:

If virtual_alias_maps is configured and working successfully and an email
address is defined in /etc/aliases to forward the emails of the root user,
the configuration from /etc/aliases is NOT evaluated anymore.

No, use of virtual(5) aliases (on input during queue file creation) does
not in any preclude additional later use of local aliases(5) during
message delivery, when the recipient domain or full recipient address
resolves to a transport handled by the local(8) delivery agent,
typically when the recipient domain is listed in $mydestination.

/etc/aliases (relevant excerpt)
# Person who should get root's mail. Don't receive mail as root!
# Tachtler
# default: #root: you
root:      kl...@tachtler.net

If, after any rewriting on input the final recipient is
"root@local.example" and "local.example" is listed in $mydestination,
the transport table directs "root@local.example" to a local(8)-based
transport, then the above alias would redirect the mail to
"kl...@tachtler.net".

That said, precisely this sort of address-to-address redirect is much
better (more efficiently and reliably) done via virtual aliases.

An email generated locally as follows would be delivered to the user
r...@tachtler.net and not to the user kl...@tachtler.net as expected?

If the local(8) delivery agent is bypassed, or $alias_maps is not set to
point to that file, or "newaliases" has not been run, ...  then perhaps
the alias would not take effect.



--

---------------------------------------
e-Mail  : kl...@tachtler.net
Homepage: https://www.tachtler.net
DokuWiki: https://dokuwiki.tachtler.net
---------------------------------------

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

Reply via email to