Email account using wrong account for storage

Email account using wrong account for storage

Description

when creating an email account with the same name as another email account, it wont be delivered to the correct account as per configuration

Steps to Reproduce

  • have email account named accounts@example1 for one domain
  • add a second account(accounts2) for the emails in accounts@example2
  • route mail using manage mailboxes to the accounts2 for accounts@example2
  • check mail box, emails from accounts@example1 appear in accounts@example2 inbox
  • select user settings on accounts@example2 in the manage mailbox page and it will take you to the main user account for accounts@example1

Expected Behavior

accounts@example1 and accounts@example2 to be different inboxes

Actual Behavior

they use the same base storage

Environment

APISCP Version: revision: 34ed4ba48b85b4fbfd6888c21d93a6d01409a671
timestamp: 1694138118
ver_maj: 3
ver_min: 2
ver_patch: 38
ver_pre: ‘’
dirty: false
debug: false
Operating System: `5.4.251-1.el8.elrepo.x86_64 rocky linux 8.7

Additional relevant information (e.g., PHP version, database, etc.):
N/A

I’m not able to reproduce.

What’s visible in Mail > Manage Mailboxes is how Postfix delivers the message.

# echo foo | mail -s test accounts@example2.test
# tail -n 5 /var/log/maillog
Sep  9 10:57:17 rocky-test postfix/pickup[1733069]: 189266092893: uid=0 from=<root>
Sep  9 10:57:17 rocky-test postfix/cleanup[1739077]: 189266092893: message-id=<20230909155717.189266092893@rocky-test.apisnetworks.com>
Sep  9 10:57:17 rocky-test postfix/qmgr[851057]: 189266092893: from=<root@rocky-test.apisnetworks.com>, size=504, nrcpt=1 (queue active)
Sep  9 10:57:17 rocky-test postfix/pipe[1739085]: 189266092893: to=<accounts@example2.test>, relay=vmaildrop, delay=0.27, delays=0.19/0.04/0/0.03, dsn=2.0.0, status=sent (delivered via vmaildrop service)
Sep  9 10:57:17 rocky-test postfix/qmgr[851057]: 189266092893: removed

# ls -1 /home/virtual/benchmark.test/home/accounts2/Mail/new/
'1694275037.M317706P1739086V000000000000002AI0000000002037F90_0.rocky-test.apisnetworks.com,S=597'

The only way for this to happen would be if accounts@example2.test was misconfigured to deliver to user “accounts”, not “accounts2”. In this case it would be reflected as the destination user in Mail > Manage Mailboxes. Likewise the actual transaction can be verified using postmap:

# postmap -q "accounts@example1.test"  pgsql:/etc/postfix/mailboxes.cf
site1/fst/home/bm2/Mail//
# postmap -q "accounts@example2.test"  pgsql:/etc/postfix/mailboxes.cf
site1/fst/home/accounts2/Mail//

interestingly enough postmap does say that the emails are going to the right inbox, but when i opened that account in roundcube it was opening accounts@example1.test’s email box

Login is user@domain where any domain attached to an account is a valid login, not email address.

You’d want to login as accounts2@example2.net, which is equivalent to accounts2@example1.net. If that is confusing, then you can always swap @ with # such that it becomes accounts2#example1.net.

yeah thats what i used, accounts@example2.test on roundcube and it showed me all the emails from accounts@example1.test, additionally when i click user settings in the drop down mail > manage mailboxes it takes me to accounts@example1.test’s account while still saying accounts@example2’s account in destination
image

i am not talking about panel access, only roundcube access, shouldnt it give me a wrong user if i were to use accounts@example2.test instead of just logging me into that account

In the aforementioned screenshot to access accounts@secleaners.com.au, you would login as secaccounts@secleaners.com.au, not accounts@secleaners.com.au. Logging in with the login accounts@secleaners.com.au would log you into the user account for “accounts”, not “secaccounts”.

thats what id expect according to what youve said, but thats not the case, see screenshot below, when i log in to accounts@secleaners.com.au it shows that as the user and emails sent from that address come from the address in the screenshot below, the only difference is that it is stored in the user directory of the accounts@otheremail.com,
image
ill put 2 more images in other replies, sorry for spam but as a new account i cant attach more than 1 image

image

image

seems like i was using the password for accounts to log in, which might be why its using the accounts storage, but then the username should be wrong. using the correct username as per your instruction(secaccounts) and the password for secaccounts gives me a user that is secaccounts@secleaners.com.au and sends email from that account instead with no option to send from accounts@secleaners.com.au

From a test account,

In this situation both accounts@emailtest.test and secaccounts@emailtest.test deliver to the same user, secaccounts. Whatever is listed in Mail > Mail Routing wins. You can login to webmail using the login “accounts@emailtest.test” but any responses sent from this account - which is stored in /home/accounts/Mail/.Sent/cur would be delivered to user secaccounts, not accounts.

After logging in to webmail as “accounts@emailtest.test” and sending an email to accounts@emailtest.test CC secaccounts@emailtest.test, both were delivered to the user specified in Mail Routing.

When working with the same name across multiple domains, use namespacing to group addresses
of a similar domain. Override the “From” field in your email client.

  • Roundcube: Settings > Identities > Select login > Change “Email”
  • SquirrelMail: Options > Personal Information > Change “E-mail Address”
  • Thunderbird: Tools > Account Settings > Select account > Default Identity > Change “Email Address”
  • Outlook: File > Info > Account Settings > Select account > Change “Reply-to address”