Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel1
outlinefalse
styledefault
typelist
printabletrue

In certain situations, JEMHC may be set up to reject incoming emails. This rejection can occur due to a global setting, such as the issue comment limit, or a specific project mapping setting, like the processing mode. Additionally, JEMHC offers the option to inform the sender that their email has been rejected by sending a message rejection notification. This notification feature can be configured within the project mapping settings.

Access message rejection configuration within a project mapping

Message rejection settings can be found in the Pre-Processing section of a Project Mapping. The settings will be inherited from the default Project Mapping if it is not overridden.

...

Selecting a message rejection notifications template

The template set that is used to create message rejection notifications can be selected via Project Mapping → Templates → Message Rejected Template Set:

...

...

Customizing message rejection

...

When issue matches JQL query

The Reject comment on JQL Match setting rejects emails that would comment on an issue matching a specific JQL query.

...

When issue is in specified status

To prevent JEMHC from commenting on issues with certain statuses, select these statuses in the Reject Comment On Status setting.

...

Using the default rejection template, the sender will get an email similar to the below:

...

When issue has been in resolved status for a number of days

The Reject Comments When Issue Resolved For More Than Days setting prevents users from commenting on issues that have been in a resolved status for a specific period of time. After the number of days has elapsed any comment on the issue will be rejected and a rejection notification will be sent to the sender of the comment email.

...

Rejection notification received by the sender of the rejected comment email:

...

When issue comment limit has been reached

Issues can be configured with a maximum number of comments within JEMHC. If a comment is attempted on an issue that has reached it's comment limit then the email will be rejected.

  1. Enable Issue comment limit within a profile
    An issue comment limit can be defined within a profile, this limit will be apply to all Project Mappings within the associated profile. For example you could limit issues to a maximum of 1 comment. Any comments via JEMHC that are attempted on the issue after the comment count has reached the defined maximum will be rejected.

    Image Removed
  2. Enable rejection notification for issue comment limit
    A rejection message can be sent to the sender of the email by enabling Notify Sender On Comment Limit Exceeded in the message rejection section of pre-processing:

    Image Removed

The above configuration will results in a rejection message being sent to the email sender when a comment on an issue has been rejected due to the issue comment limit being reached:

...

When processing mode is comment only

Some users only configure JEMHC to comment on existing issues. In a scenario where a user sends an email that doesn’t get associated with an existing issue (therefore resulting in attempted issue creation which will fail), you may want to notify the sender of the email that their email was rejected because a comment couldn’t be made on an existing issue. You can enable this notification by enabling Notify Sender When An Issue Creation Is Rejected Due To 'Comment Only' Mode.

...

Rejection notification received by the sender of the rejected email:

...

When sender is uninvolved with issue

A user may try to send an email regarding an issue they haven't been associated with previously. In such cases, since they lack permission to comment, their email will be rejected. By default, the user won’t receive any notification about this rejection; however, an email will be sent to the profiles configured Forward User Email Addresses. To ensure that the sender is also notified, you can enable Notify Sender When Cannot Comment Due To Not Being Involved.

...

Rejection notification received by the sender of the rejected email:

...

Configure new issue creation during message rejection match

Some customers may prefer to process the message instead of having it rejected when an issue comment is not accepted. This can be accomplished by enabling the Issue Creation on Comment Rejection Match configuration.

This setting is only visible if you have configured one of Reject comment on Status, Reject Comments When Issue Resolved For More Than Days or Reject comment on JQL Match message rejection features.

...

templates

Like other notification templates in JEMH Cloud, the rejection templates make use of the Apache Velocity templating language. The template has a context associated with it during render, which carries all the data related to the thing being notified about. In this case, the context contains data about the email being rejected, and why it was rejected.

Accessing the template context

To access the context from within the template code, use the $context variable. This variable is actually a https://www.javadoc.io/static/com.fasterxml.jackson.core/jackson-databind/2.18.3/com/fasterxml/jackson/databind/node/ObjectNode.html object that represents JSON data.

Expand
titleExample $context contents...
Code Block
{
    "from": "someUser1@gmail.com",
    "recipients":
    [
        "someUser2@gmail.com",
        "someUser3@gmail.com",
        "someUser4@gmail.com"
    ],
    "subject": "The subject of the orignal email",
    "body": "This is the body of the original email",
    "bodyFormat": "text",
    "messages":
    [
        "INFO - Profile: id=64, Name=someUser2@gmail.com, Mapping=Default, Message Type=Test Case",
        "INFO - Watcher not set.  JIRA user with email someUser3@gmail.com found but it doesn't have project permissions.",
        "INFO - Issue 'BSD-190' has been created.",
        "INFO - Watcher 'someUser4' added to issue.",
        "See file 'original-email.txt' attached."
    ],
    "higherType": "INFO",
    "issue":
    {
        "self": "https://somehost.atlassian.net/rest/api/latest/issue/18200",
        "key": "SSD-190",
        "id": 18200,
        "fields":
        {
            "status":
            {
                "self": "https://somehost.atlassian.net/rest/api/2/status/10003",
                "name": "Waiting for support",
                "id": 10003,
                "description": "This was auto-generated by JIRA Service Desk during workflow import",
                "iconUrl": "https://somehost.atlassian.net/images/icons/status_generic.gif"
            },
            "issueType":
            {
                "self": "https://somehost.atlassian.net/rest/api/2/issuetype/10106",
                "id": 10106,
                "name": "Access",
                "description": "For new system accounts or passwords. Created by JIRA Service Desk.",
                "iconUri": "https://somehost.atlassian.net/servicedesk/issue-type-icons?icon=access",
                "subtask": false
            },
            "project":
            {
                "self": "https://somehost.atlassian.net/rest/api/2/project/10001",
                "key": "SSD",
                "id": 10001,
                "name": "Some Service Desk Project"
            },
            "summary": "The summary of the SSD issue"
        }
    },
    "messageRejectedCause": "CANNOT_COMMENT_CLOSED_ISSUE",
    "messageRejectedMessage": "This is the reason why the message has been rejected",
    "messageRejectedSubject": "This is the subject of the reject message"
}

Conditionally show content based on email rejection cause

Available rejection causes

  • CANNOT_COMMENT_CLOSED_ISSUE

  • CANNOT_COMMENT_LIMIT_REACHED

  • CANNOT_COMMENT_RESOLVED_FOR_LONGER_THAN_DAYS

  • CANNOT_COMMENT_USER_DOES_NOT_HAVE_PERMISSION

  • CANNOT_COMMENT_EMAIL_NOT_INVOLVED

  • CANNOT_CREATE_ISSUE_WHEN_COMMENT_ONLY_MODE

  • ISSUE_CANNOT_BE_CREATED

  • REJECT_COMMENT_ON_STATUS

  • REJECT_COMMENT_ON_JQL

The email reject cause, along with the default rejection subject and body content, can be found via 3 context properties:

Template (Text)

Output

Code Block
## the type of rejection that caused this notification
$context.messageRejectedCause

## the default subject content
$context.messageRejectedSubject

## the default body content
$context.messageRejectedMessage
Code Block
"CANNOT_COMMENT_CLOSED_ISSUE"

"This is the subject of the reject message"

"This is the reason why the message has been rejected"

Template (HTML)

Output

Code Block
<p style="font: bold italic large serif">
#if ($context.messageRejectedCause.asText().equals("CANNOT_COMMENT_CLOSED_ISSUE"))
    The issue $!context.issue.key.asText() can't be commented on, please <a href="https://example.com">go here instead</a>.
#end
</p>

The issue SSD-190 can't be commented on, please go here instead.

Default rejection notification examples

...

Filter by label
showLabelsfalse
max5
sortmodified
showSpacefalse
reversetrue
cqllabel in ( "notifcations" , "template" ) and space = "JEMHC" and type = "page"