Automation For Jira - The Send Email action does not send an email to all the recipients
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
Summary
When using Automation For Jira, it is possible to configure a rule that will automatically send emails to a list of users by adding to the recipient list:
- a user picker field (Reporter, Assignee, Custom Field...)
- a group picker field
- a group
- specific email addresses
- the user who initiated the rule
The purpose of this article is to list the most common scenarios where the rule might fail to send the email to some or all the users as per the the rule configuration.
Environment
- Jira Server/Data Center on any version from 8.0.0
- Automation For Jira (A4J) on any version
Note about the "Send Email" action
Something that is very important to note about the Send Email action is that it works differently than the regular Jira notification feature. The table below lists the main differences between both mail features.
Automation "Send Email" action | Jira Notification feature |
---|---|
Users are not required to have Jira application access to receive an email from the rule. | Users are required to have Jira application access to receive a Jira notification. |
Users are not required to have the permission to view the issue, is the Send Email action contains date related to a specific Jira issue. | Users are required to have the permission to view the issue, if a Jira notification is triggered from a specific Jira issue. |
If multiple users are eligible to receive an email from the rule, the rule will send 1 single email and will concatenate all the user email addresses into the "To" header (or "CC" or "BCC").
| The Jira notification feature will send 1 individual email per Jira user eligible to receive a notification from an event (as per the notification scheme configuration). |
The rule can only send an email to the first 100 users from a Jira group.
| There is no limitation for the number of Jira users that can receive a Jira notification from an event (as per the notification scheme configuration). |
Diagnosis
To troubleshoot this type of issue and to identify which root cause might be relevant, please follow the steps below:
- Go to the page ⚙ > System > Logging and Profiling
- Click on Enable on outgoing mail logging
- Then underneath that click Enable Debugging
- Replicate the issue by triggering the rule that is sending the email
- Check the the Jira outgoing mail logs in the file <JIRA_HOME>/log/atlassian-jira-outgoing-mail.log
- Look for entries that contain the string "Sending mailitem To=" along with "Subject=<SUBJECT_FROM_ACTION>" (<SUBJECT_FROM_ACTION> being the subject configured in the "Send Email" action)
For example:
2024-11-26 14:43:25,700+0000 DEBUG [] Sending mailitem To='someaddress2@atlassian.com,someaddress@atlassian.com,someaddress3@atlassian.com' Subject='Test from A4J' From='jiraoutgoingmailserver@gmail.com' FromName='' Cc='' Bcc='' ReplyTo='' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@1f56bfe9' MessageId='null' ExcludeSubjectPrefix=true' admin 883x2771x1 yh1nw2 172.29.211.209,172.50.0.3 /secure/admin/MailQueueAdmin.jspa [c.atlassian.mail.outgoing] Message was sent with Message-Id <465617458.15.1732632205200@d7a7a59de671>
If you see the error "Invalid Addresses" in the logs, similar to one shown below, then Root Cause 1 is relevant:
2024-11-26 14:34:00,899+0000 ERROR [] Sending mailitem To='héy@gmail.com,anotheruser@gmail.com,someuser@gmail.com' Subject='Test from A4J' From='jiraoutgoingmailserver@gmail.com' FromName='' Cc='' Bcc='' ReplyTo='' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@75ee25b6' MessageId='null' ExcludeSubjectPrefix=true' anonymous Mail Queue Service [c.a.mail.queue.MailQueueImpl] Error occurred in sending e-mail: To='héy@gmail.com,anotheruser@gmail.com,someuser@gmail.com' Subject='Test from A4J' From='jiraoutgoingmailserver@gmail.com' FromName='' Cc='' Bcc='' ReplyTo='' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@75ee25b6' MessageId='null' ExcludeSubjectPrefix=true' com.atlassian.mail.MailException: javax.mail.SendFailedException: Invalid Addresses; nested exception is: com.sun.mail.smtp.SMTPAddressFailedException: 555-5.5.2 Syntax error, cannot decode response. For more information, go to 555-5.5.2 https://support.google.com/a/answer/3221692 and review RFC 5321 555 5.5.2 specifications. ffacd0b85a97d-3825fd04ec7sm13503049f8f.110 - gsmtp at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:240) [atlassian-mail-6.0.2.jar:?] at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:39) [atlassian-mail-6.0.2.jar:?] at com.atlassian.jira.mail.CountingMailQueueItemWrapper.send(CountingMailQueueItemWrapper.java:26) [classes/:?] at com.atlassian.mail.queue.MailQueueImpl.sendBufferUnderLock(MailQueueImpl.java:83) [atlassian-mail-6.0.2.jar:?] at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:47) [atlassian-mail-6.0.2.jar:?]
- If you don't see any error, move on to the next steps below
- Check the header that contains the list of recipients configured in the automation rule (To=, Cc= or Bcc= depending on the rule configuration)
- If you see that the list of recipient contains exactly 100 email addresses, and if the rule was configured to send an email to a group of more than 100 users, then Root Cause 2 is relevant
- If the list of recipients does not contain exactly 100 email addresses, then Root Cause 3 "might" be relevant
- Look for entries that contain the string "Sending mailitem To=" along with "Subject=<SUBJECT_FROM_ACTION>" (<SUBJECT_FROM_ACTION> being the subject configured in the "Send Email" action)
Cause
Root Cause 1 - At least one of the recipient of the email has an invalid address
If at least one of the recipient of the email has an invalid address (for example héy@gmail.com, which contains the invalid character é), the rule will fail to send the email to all the recipients, even if the other recipients have a correct address. The reason why other recipients will not receive the email is because the Send Email action will send 1 single email with all the user email addresses in the recipient list (instead of sending 1 separate email to each recipient). If at least 1 address is invalid, the SMTP Mail Server will reject the email.
Root Cause 2 - The "Send Email" action can only send emails to 100 users max
The Send Email action can only send an email to the first 100 users of a Jira group. If a group contains more than 100 users, any user located after the 100th user will not receive the email.
There is an open feature request meant to change this behavior:
JIRAAUTOSERVER-859
-
Getting issue details...
STATUS
Root Cause 3 - The SMTP Mail Server is configured with a recipient limit
Some mail server such as Exchange servers can be configured with a recipient limit, as described in this Microsoft Documentation about Recipient limits. As mentioned in this documentation, Exchange Servers have a setting called Maximum number of recipients in a message that's sent by the specific sender which is unlimited by default, but which can be changed to a specific value.
Since the Send Email action will send 1 single email with all the user email addresses in the recipient list, if the Mail Server is configured with a recipient limit, it is possible that the rule will either completely fail, or will only be able to send the email to a limited number of users, depending on how the SMTP Mail Server handles this limit.
Solution
Solution for Root Cause 1
- Identify the invalid email address(es) in the error from outgoing mail logs (look for invalid email characters, such as è, ë, é, ä, etc...)
- Go to Jira's user management page in ⚙ > User Management > Users
- Search for the invalid email address to identify the user this address belongs to, and fix it
Note that, if the user was synced from an external LDAP directory, you might have to fix the email address in the LDAP directory first and then sync Jira with this directory
Solution for Root Cause 2
Due to the feature limitation, there is no straight forward solution to it.
One possible solution consists in:
- Splitting the group into 2 smaller groups of 100 users max
- Splitting the Send Email action into 2 separate Send Email actions, and configuring each of them with a different group
Solution for Root Cause 3
For this solution, we recommend reaching out to your Mail Server administrator to ask then to increase the recipient limit.