Filter emails that have been Thread Matched

Summary

If you would like to drop all comments that have been thread matched (using a Message-id found within the References or In-Reply-To header) then you would need a script that will detect if the email is commenting and if the related Issue was found through thread matching and if so then filter the email.

Script Example

The below script checks if there is a related Issue and then checks if the related issue key can be found within the subject, if not then it means that the email was thread matched and will result in the email being dropped.

if(relatedIssue) //Checks if the email is commenting on an issue { print("Extractd Related Issuekey: " + relatedIssue.key); //Displays the related Issue key within the Processing Report print("Email Subject: " + subject); //Displays the Subject within the Processing Report if(!subject.contains(relatedIssue.key)) //Checks if the related Issue Key can be found within the Subject, If not then the following will run { print("Email was threaded as Subject does not contain the Issue Key"); //Displays that the email was threaded within the Report. jemhUtils.dropMessage("email is Threaded to an issue so should not comment"); //Drops the message if the subject does not have the Issuekey in the subject } else { print("issuekey found in subject so can comment"); //Displays that a Issuekey was found in subject so should comment } }

Changing Outcome

Within the Script above it will Drop the email which means that it will stop the processing of the email and will Not notify the Forward user or the Email Sender. This outcome can be changed to a different outcome by modifying line 9 to use a different filter.

Below are the filters that can be used on line 9:

Filter

Description

Filter

Description

jemhUtils.dropMessage("reason")

Stops this profile from processing of that email and will not notify anyone. If using a Profile Group then another Profile will be checked. If using a single Profile then the email will just be dropped.

jemhUtils.dropAndExitGroupMessage("reason")

Completely stops the Processing of the email and will not notify anyone. If using a Profile Group then no further profiles will be checked.

jemhUtils.forwardMessage("reason")

Stops the processing of the email and will notify the Forward User.

jemhUtils.rejectMessage("reason")

Stops the processing of the email and will notify the Email Sender.

Note: Requires Hint Notifications to notify the email sender, if not enabled then the forward user will be notified. For more info about Hint Notifications see: https://thepluginpeople.atlassian.net/wiki/spaces/JEMH/pages/3604185096