On Thu, 18 Jun 2020 at 08:13, David Hobley <david.hob...@sharpblue.com.au> wrote:
> Sorry, that got sent prior to my completing the email. I'll try again. > > /etc/postfix/main.cf > alias_maps = > append_dot_mydomain = no > compatibility_level = 2 > ... > myorigin = /etc/mailname ... > virtual_alias_domains = > virtual_alias_maps = hash:/etc/postfix/virtual > virtual_mailbox_domains = domain1.com, domain2.com, domain3.com > virtual_mailbox_maps = mysql:/etc/postfix/mysql-users.cf > virtual_transport = lmtp:unix:/kopano/dagent.sock > > The virtual aliases look like: > user1firstname.lastn...@domain3.com user1firstname.lastname > > user2firstn...@domain2.com user2firstname.lastname > user2firstn...@domain1.com user2firstname.lastname > user2firstname.lastn...@domain2.com user2firstname.lastname > > @domain3.com user2firstname.lastname > @domain2.com user1firstname.lastname > @domain1.com user1firstname.lastname > > > In effect, I have 3 users created for domain1.com. A catchall for domain1 > and domain2 to direct to user 1. Ignore domain3 for the time being. > > For some reason though, all emails are ending up in user1’s Inbox. If I > send an email from an external email address to > user2firstname.lastn...@domain1.com it ends up in > user1firstname.lastname’s email. If I send an email to > user2firstn...@domain2.com it also ends up in user1firstname.lastname's > email. > > Interestingly, if I remove the @domain1.com catchall in the > /etc/postfix/virtual file, email gets delivered correctly to > user2firstname.lastn...@domain1.com and user2firstn...@domain2.com... > > Can anyone point me in the correct direction please. I have spent a couple > of days on this trying to work out where I have gone wrong and I am > mystified. Happy to provide a more full-featured config if that helps. > You presumably have the default setting: append_at_myorigin = yes Refer to http://www.postfix.org/virtual.5.html. Bear in mind that processing of virtual alias table is recursive. So: the first time, user2firstn...@domain2.com is rewritten to user2firstname.lastn...@domain1.com (i.e. the 'myorigin' is appended, I am guessing domain1.com is set in /etc/mailname) Because a change occurred this is then passed back through the same file and (unless you remove the @domain1.com catchall) gets rewritten to user1firstname.lastn...@domain1.com