Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-33345

Mail Handler should better handle messages that are rejected due to recipient not matching catch mail list or bulk detection

    XMLWordPrintable

Details

    Description

      Issue Summary

      Incoming Emails might be rejected by the Jira Mail Handler for any of the following reasons:

      • none of the recipient email address from the incoming email matched the catch email address configuration in the mail handler
      • the incoming email is an auto-generated email and is detected as a "bulk email" by the mail handler

      In such cases, the mail handler keeps the incoming mail as "UNREAD" instead of marking is as "READ" in the mailbox. As a result, whenever the mail handler scans the mailbox, it will keep processing these emails over and over, resulting in the following consequences:

      • the Jira incoming Mail logs will get flooded with WARN/INFO logs saying "The message has been rejected:"
      • if the mailbox contains a huge amount of those emails, the mail handler will run very slowly (as it needs to scan over and over these same emails), consumes the caesium threads and prevent other services (such as the notification mail queue service) to run on schedule

      Here are 2 possible scenarios where this issue can occur:

      Scenario 1

      When you specify an email address in the Catch Email Address field of an Incoming Mail Handler, and an email message's recipent(s) does not match the Catch Email Address field, the following message is logged:

      2013-05-28 06:44:48,156 INFO [POP Mail for TKN] QuartzWorker-1 ServiceRunner    
      Create Issue / Comment for Project TKN The message has been rejected: The messages recipient(s) does not match catch mail list.
      

      Scenario 2

      When an auto-generated email is sent to the Jira Mail Handler, the mail handler will keep pulling and processing that same email over and over again, the following will be seen in the logs:

      2020-12-03 14:34:17,469+0100 DEBUG [GMAIL SERVER] Caesium-1-1 anonymous    Mail handler for SCRUMP project - GMAIL Mail handler for SCRUMP project - GMAIL[10400]: The message has been rejected (Rejecting message due to failed bulk check.): From :[Julien Rey <test@test.com>], Subject: I'm out of the office Re: Test, Date: 
      

      Suggestion

      The Jira mail handler should either mark such emails as "READ" (with IMAP), or delete them (with POP), so that such emails stop being processed.

      Workaround

      Scenario where the email was rejected due to the "Catch email" setting

      The only way to stop the Jira Mail handler to keep processing such emails over and over is to delete them from the Mailbox the mail handler is pulling emails from, or to mark them as READ.

      Please note that such emails might still be stuck in the Jira mail handler data cache, so if the mail handler is still processing them:

      • you can either perform a Jira re-start in order to clear the data cache
      • or delete the mail handler from ⚙ > System > Incoming Mail, and re-create it

      Scenario where the email was rejected due to the bulk detection

      You can either follow the same workaround above (in case of catch email address detection). Or, for a long term fix, change the mail handler configuration by setting the Bulk field to Delete the email permanently

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dleng Daniel Leng (Inactive)
              Votes:
              27 Vote for this issue
              Watchers:
              34 Start watching this issue

              Dates

                Created:
                Updated: