How to get a users email address?

I am trying to update a JIRA plugin that used to fetch and display a users email address. The user.getEmail method was depreciated and referred to user.getEmailAddress which has now been depreciated, but this is where the trail has gone cold for me. Any suggestions?

String getEmail()
Deprecated. Please use getEmailAddress().


1 answer

1 accepted

2 votes
Accepted answer
Add SAL component to your atlassian-plugin.xml.
  name="SAL User Manager"
Now in the code this should do it
import com.atlassian.sal.api.user.UserManager;
import com.atlassian.sal.api.user.UserProfile;

public class MyClass
  private UserManager userManager;

  public void setUserManager(UserManager userManager)
    this.userManager = userManager;

  public void testMethod()
    String username  = userManager.getRemoteUsername();
    UserProfile up = userManager.getUserProfile(username);
    String email = up.getEmail();

Hi Jangid,

I had hoped to test your solution but I have been sidelined with other work. I am going to mark your answer as correct, it looks pretty solid to me.

Thanks for your input, I was completely stumped.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Sunday in Feedback & Announcements

How do you analyze GC logs, thread dumps and head dumps?

Hi awesome community!  In this article, I would like to describe the one of the toolset (service) for the analyze some problems on different Java-based instances, of course, as Atlassian admini...

114 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you