On Tue, Jan 17, 2023 at 03:31:43PM +0000, sa212+post...@cyconix.com wrote: > I've been doing some tests with normal (foo@domain), catch-all (@domain), > and plussed (foo+foo@domain) addresses, with the virtual(8) delivery agent, > and virtual_alias_maps and virtual_mailbox_maps. > > The idea is to check the setup of users who want both redirection and > delivery to a local mailbox (with Dovecot, and Maildir format). > This worked as I expected, except in one case: when mail is sent to an > unknown recipient, and the catch-all setup is used, it's not possible to > both redirect the incoming mail, *and* have it delivered to a local mailbox. > Is this expected? It looks like a bug, because the destination MTA (the one > that receives the redirect) gets a badly-formed RCPT. > Tests as follows, with the virtual_alias_maps file being 'valias', and the > virtual_mailbox_maps file being 'vmailbox', and the local domain being > example.com: > > (1) Mail to known user 'f...@example.com': > > valias: "f...@example.com f...@example.com, f...@external.org" > vmailbox: "f...@example.com example.com/foo/" > > This works: external.org gets the mail, and Dovecot also gets the mail from > mailbox 'foo/'. > > (2) Mail to unknown user 'unkn...@example.com': > > valias: "@example.com @example.com, f...@external.org" > vmailbox: "@example.com example.com/foo/" > > This fails: external.org doesn't get the mail, but Dovecot does get the mail > from mailbox 'foo/'. > > The mail log at external.org shows that Postfix did try to redirect the > mail, but sent it to an invalid address: > > Recipient address rejected: User unknown in virtual mailbox table; > from=<f...@example.com> to=<"unkn...@example.com, foo"@external.org>
I'm not suprised that it didn't work. I would have thought that "@example.com" is not a valid alias target since it's not a valid email address. That might not be the reason that it didn't work, but it would make sense. > Second question: with my current setup, an entry is created in virtual_alias > maps even if the user doesn't want redirection, but only wants local > delivery. In other words, if user 'bar' wants local delivery, then the file > entries are: > > valias: "b...@example.com b...@example.com" > vmailbox: "b...@example.com example.com/bar/" > > This works, and doesn't seem to cause a problem. I don't really want to > change the software to remove this (unnecessary) entry in valias. Are there > likely to be any problems with this? I don't know, but if it works, it will probably continue to work. cheers, raf