Jira is not processing new incoming emails (or processing them with a long delay)
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Symptoms
The Jira Core Mail Handler is not processing new incoming emails, or processing them with a very long delay.
Diagnosis
- Jira application is configured with mail handlers under ⚙> System > Incoming mail > Mail Handlers
- The issue doesn't happen for all mail handlers
- After enabling debugging for Incoming mail in ⚙> System > Logging and profiling,
atlassian-jira-incoming-mail.log
shows many emails found for processing in the affected mailbox:2021-06-24 11:37:59,599+0300 DEBUG [ABC mail server ] Caesium-1-2 anonymous ABC Emails ABC Emails[11600]: Found 2790 unprocessed message(s) in the imaps folder
- When grepping "Execution id: XXXXX', XXXXX being the ID of the mail handler (11600 as per the log above), we can see that the Mail Handler is executed infrequently instead of every 1 min:
grep -h 'Execution id: 11600' atlassian-jira-incoming-mail.log | sort 2021-01-22 13:10:00,020+0000 DEBUG [ABC mail server] Caesium-1-4 anonymous ABC Emails Execution id: 11600 2021-01-22 13:29:00,009+0000 DEBUG [ABC mail server] Caesium-1-2 anonymous ABC Emails Execution id: 11600 2021-01-22 13:48:00,009+0000 DEBUG [ABC mail server] Caesium-1-3 anonymous ABC Emails Execution id: 11600 2021-01-22 14:07:00,004+0000 DEBUG [ABC mail server] Caesium-1-2 anonymous ABC Emails Execution id: 11600 2021-01-22 14:27:00,003+0000 DEBUG [ABC mail server] Caesium-1-1 anonymous ABC Emails Execution id: 11600 2021-01-22 14:47:00,005+0000 DEBUG [ABC mail server] Caesium-1-4 anonymous ABC Emails Execution id: 11600 2021-01-22 15:08:00,008+0000 DEBUG [ABC mail server] Caesium-1-4 anonymous ABC Emails Execution id: 11600
The log files atlassian-jira-incoming-mail.log
also contain a lot of events like below:
Scenario 1
2021-06-24 11:38:04,335+0300 DEBUG [ABC mail server ] Caesium-1-2 anonymous ABC Emails ABC Emails[11600]: The message has been rejected (Rejecting message due to failed bulk check.): From :[Anonymous <anonymous@domain.com>], Subject: Random subject, Date:...
Scenario 2
2013-05-28 06:44:48,156 INFO [POP Mail for ABC] QuartzWorker-1 ServiceRunner Create Issue / Comment for Project ABC The message has been rejected: The messages recipient(s) does not match catch mail list.
Scenario 3
2021-06-24 11:38:04,335+0300 WARN [ABC mail server ] Caesium-1-2 anonymous ABC Emails ABC Emails[11600]: Cannot create issue due to invalid license: [Sorry, you can't create any issues right now, as you need to have access to a Jira application to be able to create issues. To gain application access you need to be a member of a group assigned to an application.]
Cause
Scenario 1 happens when the mailbox contains a lot of auto-generated emails which Jira categorizes as bulk emails, and when the Incoming Mail Handler is configured with the Bulk setting set to ignore the email and do nothing.
Scenario 2 happens when you specify an email address in the Catch Email Address field of an Incoming Mail Handler, and the recipient(s) email does not match the Catch Email Address field.
In both cases, the mail handler keeps the incoming emails 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).
This issue is a result of the bug from below:
- JRASERVER-33345 - Getting issue details... STATUS
Scenario 3 happens when a lot of emails are sent to the Jira Mail Handler and these emails cannot be processed and remain marked as UNREAD, because of any of the sub-scenario listed below:
- Scenario 3-1
- These emails are coming from Jira users who don't have application access
- These is no default reporter configured for the mail handler
- Scenario 3-2
- These emails are coming from Jira users who don't have application access
- These is a default reporter configured for the mail handler
- The default reporter does not have application access
- Scenario 3-3
- These emails are coming from Jira users who don't have application access
- These is a default reporter configured for the mail handler
- The default reporter has application access
- The Jira application is not on any fixed version (8.20.12, 8.22.6, 9.1.1) for the bug JRASERVER-63285 - Getting issue details... STATUS
In the Scenarios 3-1, 3-2, 3-3, the emails will remain marked as UNREAD, and the mail handler will keep on processing and rejecting them over and over at each execution time, causing eventually a lot of delay with the processing of incoming emails.
Solution
Solution for all scenarios
Clean the mailbox from the unwanted emails.
Solution specific to Scenario 1
For scenario where the email was rejected due to the bulk detection, the long term solution is to change the mail handler configuration by setting the Bulk field to Delete the email permanently.
To change the mail handler configuration:
- Click the Edit button on mail handler configuration in the Incoming Mail configuration page
- Click Next button on the mail handler configuration
- Select "Delete the email permanently" in Bulk setting.
Solution specific to Scenario 3
- Make sure that the Mail Handler is configured with a Default Reporter that has Jira application access, and also the permission to create issues in the Project associated to the Mail Handler
- Maker sure to upgrade the Jira application to a fixed version (8.20.12, 8.22.6, 9.1.1 or any higher versions) for the bug JRASERVER-63285 - Getting issue details... STATUS