JIRA mail handler to check for user email address in the Reply-To header

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Won't Do
    • None
    • Component/s: None
    • None

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      JIRA create issue handler currently retrieve the email sender address from the "From" header. This can be found in the getSenders method in the MailUtils class:

      public static List<String> getSenders(Message message) throws MessagingException
          {
      
              ArrayList<String> senders = new ArrayList<String>();
              Address[] addresses = message.getFrom();
              if (addresses != null)
              {
                  for (int i = 0; i < addresses.length; i++)
                  {
                      if (addresses[i] instanceof InternetAddress)
                      {
                          InternetAddress addr = (InternetAddress) addresses[i];
                          // Trim down the email address to remove any whitespace etc.
                          String emailAddress = StringUtils.trimToNull(addr.getAddress());
                          if (emailAddress != null)
                          {
                              senders.add(emailAddress);
                          }
                      }
                  }
              }
              return senders;
          }
      

      Thus, when creating a new issue from email, the issue reporter will be the user that is retrieved from the "From" header of the email.

      However in some cases, this might not be accurate as the "From" header of the email might not contain the correct sender email address. As an example, when the create issue handler process emails that have the "From" header such as below, the issue will be created using the wrong email address:

      Date: Tue, 23 Dec 2014 10:33:55 +0800
      From: "'test' via support" <support@bitbucket.org>
      Reply-To: test@mail.com
      To: "support" <support@bitbucket.org>
      

      Therefore as a suggestion, the create issue handler should also inspect the "Reply-To" header when getting the reporter email address, as the "From" header might contain the wrong address.

            Assignee:
            Unassigned
            Reporter:
            Ahmad Faisal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: