Removing References and In-Reply-To headers when processing a Forwarded email

Summary

If you would like forward emails to not be Thread Matched by the References or In-Reply-To headers, then you would need to use a Script Pre-Proc Task that will check if the relevant forward prefix can be found in the subject and if so then remove the References and In-Reply-To headers, as this will then stop Thread Matching from occurring.

Note: If the subject contains a valid Issue Key then it will still result in a comment being added.

Example Script

Currently there is a bug that results in the Headers not being removed if “Matching Headers” does not have a header that is being kept within the issue.

Due to this, you will need to ensure that one of the Matching Headers will not be removed by the script. In this case, the Subject header.

if(headerBeans.get("subject") && subject.contains("Fwd")) { if(subject.contains("Fwd:")) { if(headerBeans.get("in-reply-to")) { headerBeans.remove("in-reply-to"); } if(headerBeans.get("references")) { headerBeans.remove("references"); } } }

Example Matching Headers

Reference,In-Reply-To,Subject

Screenshot of Script Pre-Proc config

image-20240426-124705.png