Having two users with the same email address can cause email problems - JRASERVER-9182
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem definition
As Jira doesn’t enforce email uniqueness, there is a chance that the same email address will be assigned to a couple of different users. Also, different users (with the same email address) can have different permissions in a project which can create problems. For example:
user1
doesn’t have permission to create an issue in projectA
user2
has permission to create an issue in projectA
incoming mail feature is configured to create issues in project
A
If a message comes from an email address that is associated with user1
and user2
, the incoming mail handler will reject such a message as the given user doesn’t have proper permission.
Why it’s happening
Jira is designed in a way that allows the creation of multiple users with the same email address and it actually is bulletproof in that matter. Application always picks up the first user that is associated with a given email address in an alphabetical order (that’s why user1
will always be selected in the example above). Jira doesn’t check every user’s permission or select the user with a proper one (or the user with the most permissions). Enforcing email uniqueness would be a breaking change and it won’t be compatible with a lot of already configured instances.
Workaround
If you know which user should be picked for the incoming mail handler, the simplest solution is to change this user’s name to one that will precede the other existing names, e.g. user1
→ user2
or jack
→ joe
. This can be either modified via the UI or REST API (https://developer.atlassian.com/server/jira/platform/rest/v10004/api-group-user/#api-api-2-user-put).
If you don’t know which user should be picked, follow this SQL query to identify users with duplicated email addresses:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
with users as (
select lower_user_name, lower_email_address
from cwd_user CU
join cwd_directory CD on CU.directory_id = CD.id and CD.active = 1
group by lower_user_name, lower_email_address),
duplicated as (
select lower_email_address from users
group by lower_email_address
having count(lower_email_address) > 1)
select U.lower_user_name, U.lower_email_address, CD.directory_name , coalesce (UA.attribute_name, 'login.count') as attribute_name, coalesce (UA.attribute_value,'0') as attribute_value
from duplicated D
join cwd_user U on D.lower_email_address = U.lower_email_address
join cwd_directory CD on U.directory_id = CD.id
left join cwd_user_attributes UA on UA.user_id = U.id and UA.attribute_name = 'login.count'
order by u.lower_email_address, attribute_value desc;
Was this helpful?