Drop an email that has a Precedence header when using a Profile Group
Summary
In a single Profile, when a incoming email matches a Project Mapping that has Message Filter Action set to ignore(drop), JEMH will Drop the email. However, when using a Profile Group, JEMH will try and find another matching Project Mapping that allow emails with a Precedence header to create Issues.
A work-around to make the Profile Group drop the email and stop checking for other Project Mappings when Precedence: bulk is present will require a Script Field Processor.
Work-around Example Script
This Script will be placed on the specific Profile with the Project Mappings that want to ignore(drop) emails with a Precedence header. The Script consists of three sections:
An array is needed to store the catch email addresses of Project Mappings that do not want to process emails with a Precedence header. These Addresses will need to be entered into the array manually.
Check if a Precedence header is in the email and the value of the header. The Script checks the value of the Precedence header as Project Mappings can allow Precedence: list headers and not Precedence: bulk headers.
Checking if the Catch email address (To address) matches a address which is stored within the array. If it does match one address then the email will be dropped.
/*Array for holding the email addresses in the domain mapping*/
emails = ["Address1", "Address2", "Address3"];
/*Saves Header value within a variable*/
var precedence = message.getHeader("Precedence");
/*If Header is not present it will be null, so this will check if header is in email*/
if (precedence !== null)
{
print('Precedence Header is in email');
if (precedence[0] == 'bulk' || 'Bulk') /*Checks if value of the Precedence header equals bulk*/
{
print('Precedence Value is bulk, now will check catch address against emails array');
for (i =0; i< toAddresses.length; i++)
{
/*Checks all to address against emails array*/
for (m =0; m< emails.length; m++)
{
if (toAddresses[i] == emails[m])
{
/*If the catch email address matches one of the addresses within the array then it will drop the message*/
print('Dropping email as Recipient address = '+ emails[m]);
jemhUtils.dropMessage('Has Precedence:bulk');
}
}
}
}
else
{
/*Output if the Precedence Value is not 'bulk'*/
print('precedence is not bulk, will create issue and stop check');
}
}
else
{
/*Output if there is no Precedence header within the email*/
print('No precedence header found');
}