Mail delivering to incorrect user
-
All,
I feel like this is a postfix issue, rather than a Kopano issue, but I thought I would check here first as there may be Kopano dependencies…
I have 3 domains and 3 users:
My postfix main.cf includes:
Kopano configuration
alias_maps =
virtual_transport = lmtp:unix:/kopano/dagent.sock
virtual_mailbox_domains = domain1.com, domain2.com, domain3.com
virtual_mailbox_maps = mysql:/etc/postfix/mysql-users.cf
virtual_alias_maps = hash:/etc/postfix/virtualThe virtual aliases look like:
user1@domain2.com user1user2@domain2.com user2
user3@domain2.com user3@domain3.com user3
@domain2.com user1
@domain1.com user1In effect, I have 3 users created in Kopano 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 user2@domain1.com it ends up in user1@domain1.com’s email.
Postfix logs show:
Jun 16 09:53:18 kopano postfix/smtp[8735]: 9665C6C28C5: to=user1@domain1.com, orig_to=user2@domain1.com, relay=127.0.0.1[127.0.0.1]:10024, delay=3.9, delays=2.2/0.01/0/1.6, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 4DFA46C28E1)Anyone any ideas?
Cheers,
David -
@hobleyd said in Mail delivering to incorrect user:
If I send an email from an external email address to user2@domain1.com it ends up in user1@domain1.com’s email.
Based on your above configuration this seems to be your domain1 catchall that is matching here.
-
@fbartels agreed. The question is why. The user2@domain1.com exists in Kopano and email should be delivered there without needing the catchall.
I can also email user2@domain2.com and it will be delivered to user1@domain1.com even though I have a specific catch for user2@domain2.com in the virtual file.
If I remove the catchall for @domain1, then email to user2@domain1.com and user2@domain2.com get delivered correctly to user2.
But then the catchall for @domain1.com isn’t there and those emails get rejected.
Cheers,
David -
@hobleyd without giving it a try locally, but wasn’t the virtual file location specific?
-
@fbartels I’m sorry, but I don’t understand the question.
I thought the virtual_mailbox_domains defined which domains I could receive email on. The virtual_alias_maps would map an email address, or catchall domain to a specific user and that virtual_mailbox_maps would lookup the Kopano database to validate that the specified user existed.
But something is definitely awry with that thought process given it doesn’t work. I did try changing the virtual_alias_maps to result in user1@domain1.com and user2@domain2.com, but that didn’t seem to make any difference either.
Cheers,
David -
@hobleyd my question in other words is “does a later definition in your alias map overwrite an earlier map”?
-
Thanks @fbartels . I did try reorganising the /etc/postfix/virtual file as such:
@domain3.com user3 @domain2.com user1 @domain1.com user1 user1@domain2.com user1 user2@domain2.com user2 user3@domain2.com user3
just in case; but it had no effect (as expected really - the postfix walkthoughs I reviewed had them in both orders). These are the only components that reference the aliases, so not sure what else could be interacting. Is that what you meant?
-
Ok, it is because the postfix rewrite process is recursive and because postfix doesn’t know which usernames are in Kopano, it keeps going until it hits the final catchall which redirects everything to user1.
By adding in
user1@domain1.com user1@domain1.com user2@domain1.com user2@domain1.com
it fixes the problem. Thanks for your help @fbartels.