I think my setup is flawed already because a simple virtual alias does not work either.
With my current virtual table and config, this happens when I send mail to <bertalan.pe...@foo.bp99.eu>: ----------------8<---------------- 89aacccc897be4ac smtp connected address=80.241.56.152 host=mout-p-102.mailbox.org debug: looking up pki "foo.bp99.eu" debug: session_start_ssl: switching to SSL debug: pony: rsae_priv_enc 89aacccc897be4ac smtp tls ciphers=TLSv1.3:AEAD-AES256-GCM-SHA384:256 smtp: 0x3c356154000: smtp_cert_verify_cb: no-client-cert debug: smtp: SIZE in MAIL FROM command expand: 0xf3c01183018: expand_insert() called for address:bertalan.pe...@foo.bp99.eu[parent=0x0, rule=0x0] expand: 0xf3c01183018: inserted node 0xf3b381c0800 expand: lka_expand: address: bertalan.pe...@foo.bp99.eu [depth=0] lookup: match "80.241.56.152" as NETADDR in table static:<anyhost> -> true expand: lka_expand: address: bertalan.pe...@foo.bp99.eu [depth=0] [0/1788] lookup: match "80.241.56.152" as NETADDR in table static:<anyhost> -> true lookup: match "foo.bp99.eu" as DOMAIN in table static:domains -> true rule #1 matched: match from any for domain domains action domain lookup: lookup "bertalan.pe...@foo.bp99.eu" as ALIAS in table static:virtuals -> none lookup: lookup "bertalan.peter" as ALIAS in table static:virtuals -> "bp99" expand: 0xf3b3d6a6000: expand_insert() called for username:bp99[parent=0x0, rule=0x0] expand: 0xf3b3d6a6000: inserted node 0xf3b381bf800 expand: 0xf3c01183018: expand_insert() called for username:bp99[parent=0xf3b381c0800, rule=0xf3bd11d8a80, dispatcher=0xf3c268d3f20] expand: 0xf3c01183018: inserted node 0xf3b381bf000 expand: 0xf3b3d6a6000: clearing expand tree expand: 0xf3b3d6a6000: freeing expand tree debug: aliases_virtual_get: 'bertalan.peter' resolved to 1 nodes expand: lka_expand: username: bp99 [depth=1, sameuser=0] lookup: lookup "bp99@" as ALIAS in table static:virtuals -> none lookup: lookup "bp99" as ALIAS in table static:virtuals -> "vmail" expand: 0xf3b3d6a6740: expand_insert() called for username:vmail[parent=0x0, rule=0x0] expand: 0xf3b3d6a6740: inserted node 0xf3bec823000 expand: 0xf3c01183018: expand_insert() called for username:vmail[parent=0xf3b381bf000, rule=0xf3bd11d8a80, dispatcher=0xf3c268d3f20] expand: 0xf3c01183018: inserted node 0xf3b381bf800 expand: 0xf3b3d6a6740: clearing expand tree expand: 0xf3b3d6a6740: freeing expand tree debug: aliases_virtual_get: 'bp99' resolved to 1 nodes expand: lka_expand: username: vmail [depth=2, sameuser=0] lookup: lookup "vmail@" as ALIAS in table static:virtuals -> none lookup: lookup "vmail" as ALIAS in table static:virtuals -> none lookup: lookup "vmail" as USERINFO in table getpwnam:<getpwnam> -> "2000:2000:/var/vmail" expand: no .forward for user vmail, just deliver expand: 0xf3c01183018: clearing expand tree smtp: 0x3c356154000: fd 15 from queue smtp: 0x3c356154000: message fd 15 smtp: 0x3c356154000: message begin debug: 0x3c356154000: end of message, error=0 89aacccc897be4ac smtp message msgid=a8c64add size=2395 nrcpt=1 proto=ESMTP debug: scheduler: evp:a8c64add5dd68743 scheduled (mda) 89aacccc897be4ac smtp envelope evpid=a8c64add5dd68743 from=<b...@bp99.eu> to=<bertalan.pe...@foo.bp99.eu> mda: new user 89aacccd047a1572 for "<getpwnam>:vmail" debug: lka: userinfo <getpwnam>:vmail lookup: lookup "vmail" as USERINFO in table getpwnam:<getpwnam> -> "2000:2000:/var/vmail" debug: mda: new session 89aaccce2ce3e528 for user "<getpwnam>:vmail" evpid a8c64add5dd68743 debug: mda: no more envelope for "<getpwnam>:vmail" debug: mda: got message fd 15 for session 89aaccce2ce3e528 evpid a8c64add5dd68743 debug: mda: querying mda fd for session 89aaccce2ce3e528 evpid a8c64add5dd68743 debug: smtpd: forking mda for session 89aaccce2ce3e528: vmail as vmail debug: mda: got mda fd 16 for session 89aaccce2ce3e528 evpid a8c64add5dd68743 debug: mda: end-of-file for session 89aaccce2ce3e528 evpid a8c64add5dd68743 debug: mda: all data sent for session 89aaccce2ce3e528 evpid a8c64add5dd68743 89aacccc897be4ac smtp disconnected reason=quit debug: smtpd: mda process done for session 89aaccce2ce3e528: exited okay 89aacccd047a1572 mda delivery evpid=a8c64add5dd68743 from=<b...@bp99.eu> to=<bertalan.pe...@foo.bp99.eu> rcpt=<bertalan.pe...@foo.bp99.eu> user=vmail delay=0s result=Ok stat=Delivered debug: mda: session 89aaccce2ce3e528 done ----------------8<---------------- What I can see here is that smtpd does a lookup for the entire address <bertalan.pe...@foo.bp99.eu> first, then as a fallback, for `bertalan.peter' in my virtuals file. It indeed fints `bp99' and it later perofmr s a further lookup for `bp99' and finds `vmail'. There are no more ‘redirections’, so for `vmail' it eventually looks up the UNIX user with getpwnam and delivers the message to what I specified in smtpd.conf. My problem is that the mail gets delivered to /var/vmail/foo.bp99.eu/bertalan.peter/. I would like to have the mail under the ‘resolved’ user’s maildir: /var/vmail/foo.bp99.eu/bp99/. I noticed that when I use my entire address in the virtuals file, like this: b...@foo.bp99.eu vmail bertalan.pe...@foo.bp99.eu b...@foo.bp99.eu It works, because the `to=' changes to the alias address. Like this: ----------------8<---------------- d5bab85c70d7b72e smtp connected address=80.241.56.151 host=mout-p-101.mailbox.org debug: looking up pki "foo.bp99.eu" debug: session_start_ssl: switching to SSL debug: pony: rsae_priv_enc d5bab85c70d7b72e smtp tls ciphers=TLSv1.3:AEAD-AES256-GCM-SHA384:256 smtp: 0x2a064624000: smtp_cert_verify_cb: no-client-cert debug: smtp: SIZE in MAIL FROM command expand: 0x44a11a57018: expand_insert() called for address:bertalan.pe...@foo.bp99.eu[parent=0x0, rule=0x0] expand: 0x44a11a57018: inserted node 0x44a78e48800 expand: lka_expand: address: bertalan.pe...@foo.bp99.eu [depth=0] lookup: match "80.241.56.151" as NETADDR in table static:<anyhost> -> true lookup: match "foo.bp99.eu" as DOMAIN in table static:domains -> true rule #1 matched: match from any for domain domains action domain lookup: lookup "bertalan.pe...@foo.bp99.eu" as ALIAS in table static:virtuals -> "b...@foo.bp99.eu" expand: 0x449fdfed6c0: expand_insert() called for address:b...@foo.bp99.eu[parent=0x0, rule=0x0] expand: 0x449fdfed6c0: inserted node 0x44a9d5c8800 expand: 0x44a11a57018: expand_insert() called for address:b...@foo.bp99.eu[parent=0x44a78e48800, rule=0x44ac17dbf80, dispatcher=0x449fdfeba10] expand: 0x44a11a57018: inserted node 0x44ac17d9000 expand: 0x449fdfed6c0: clearing expand tree expand: 0x449fdfed6c0: freeing expand tree debug: aliases_virtual_get: 'bertalan.pe...@foo.bp99.eu' resolved to 1 nodes expand: lka_expand: address: b...@foo.bp99.eu [depth=1] lookup: match "local" as NETADDR in table static:<anyhost> -> true lookup: match "foo.bp99.eu" as DOMAIN in table static:domains -> true rule #1 matched: match from any for domain domains action domain lookup: lookup "b...@foo.bp99.eu" as ALIAS in table static:virtuals -> "vmail" expand: 0x44a71211e00: expand_insert() called for username:vmail[parent=0x0, rule=0x0] expand: 0x44a71211e00: inserted node 0x44a0ac46800 expand: 0x44a11a57018: expand_insert() called for username:vmail[parent=0x44ac17d9000, rule=0x44ac17dbf80, dispatcher=0x449fdfeba10] expand: 0x44a11a57018: inserted node 0x44a11a5a800 expand: 0x44a71211e00: clearing expand tree expand: 0x44a71211e00: freeing expand tree debug: aliases_virtual_get: 'b...@foo.bp99.eu' resolved to 1 nodes expand: lka_expand: username: vmail [depth=2, sameuser=0] lookup: lookup "vmail@" as ALIAS in table static:virtuals -> none lookup: lookup "vmail" as ALIAS in table static:virtuals -> none lookup: lookup "vmail" as USERINFO in table getpwnam:<getpwnam> -> "2000:2000:/var/vmail" expand: no .forward for user vmail, just deliver expand: 0x44a11a57018: clearing expand tree smtp: 0x2a064624000: fd 15 from queue smtp: 0x2a064624000: message fd 15 smtp: 0x2a064624000: message begin debug: 0x2a064624000: end of message, error=0 d5bab85c70d7b72e smtp message msgid=68af30f1 size=2414 nrcpt=1 proto=ESMTP debug: scheduler: evp:68af30f14538283e scheduled (mda) d5bab85c70d7b72e smtp envelope evpid=68af30f14538283e from=<b...@bp99.eu> to=<bertalan.pe...@foo.bp99.eu> mda: new user d5bab85d96a8b9a7 for "<getpwnam>:vmail" debug: lka: userinfo <getpwnam>:vmail lookup: lookup "vmail" as USERINFO in table getpwnam:<getpwnam> -> "2000:2000:/var/vmail" debug: mda: new session d5bab85e72251dde for user "<getpwnam>:vmail" evpid 68af30f14538283e debug: mda: no more envelope for "<getpwnam>:vmail" debug: mda: got message fd 15 for session d5bab85e72251dde evpid 68af30f14538283e debug: mda: querying mda fd for session d5bab85e72251dde evpid 68af30f14538283e debug: smtpd: forking mda for session d5bab85e72251dde: vmail as vmail debug: mda: got mda fd 16 for session d5bab85e72251dde evpid 68af30f14538283e debug: mda: end-of-file for session d5bab85e72251dde evpid 68af30f14538283e debug: mda: all data sent for session d5bab85e72251dde evpid 68af30f14538283e d5bab85c70d7b72e smtp disconnected reason=quit debug: smtpd: mda process done for session d5bab85e72251dde: exited okay d5bab85d96a8b9a7 mda delivery evpid=68af30f14538283e from=<b...@bp99.eu> to=<b...@foo.bp99.eu> rcpt=<bertalan.pe...@foo.bp99.eu> user=vmail delay=0s result=Ok stat=Delivered debug: mda: session d5bab85e72251dde done debug: mda: user "vmail" becomes runnable debug: mda: all done for user "<getpwnam>:vmail" ----------------8<---------------- Now I see the same lookups happening, but in the end, the `to=' address is different. My only problem with this solution is that I have multiple domains, for example bp99.hu that I would like to use the same virtuals file with. It’s not that big of a problem, but this way I would have to maintain a separate virtual file for each domain. I feel that this is suboptimal, especially since smtpd seems to be intelligent enough to look not only for the entire address in the virtual table, but also for only userparts. Sorry if this is a bit off topic for this thread, but I think the problem starts here—if I can’t even get mail addressed to my virtual aliases delivered to the same mailbox, there is no point in struggling with these tagged addresses. Thank you Bertalan -- Bertalan Z. Péter <bertalan.pe...@bertalanp99.eu> PGP: FB9B 34FE 3500 3977 92AE 4809 935C 3BEB 44C1 0F89