Defining message outcomes
Introduction
This feature allows the outcome of a message's processing to be decided preemptively. This can be useful when you want messages to fail for reasons that they would not normally.
Setting Outcomes
There are currently five outcomes which can be decided via a script:
Dropped
jemhUtils.dropMessage(String reason)
Filtered
jemhUtils.filterMessage(String reason)
Forwarded
jemhUtils.forwardMessage(String reason)
Rejected
jemhUtils.rejectMessage(String reason)
Dropped (Drop and exit group)
jemhUtils.dropAndExitGroupMessage(String reason)
Single Profile Outcome handling and notifications
Single Profiles can drive a range out outcomes through scripts.
Message Outcome | Sender Notified? | Admin Notified? | Read/Deleted? |
---|---|---|---|
Dropped | No | No | Yes |
Filtered | No | No | No |
Forwarded | No | Yes | Yes |
Rejected | Yes | No | Yes |
Multiple (Profile Group) Outcome handling and notifications
When a Profile Group is used, the Outcome for a non-default Profile usually results in the mail dropping through to the next Profile eventually getting to the default Profile. The processing within a group can be aborted:
Message Outcome | Sender Notified? | Admin Notified? | Read/Deleted? |
---|---|---|---|
Dropped (Drop and exit group) | No | No | Yes |
To trigger a reject (and related notifications) within a Profile Group, the reject logic needs to exist in the Default Profile in the group.
Usage Scenarios
The historical first implementation to define the outcome was only done in Script Field Processor, this has now been expanded to the other scripted processing locations:
Script Pre Proc Task
since 5.0.5
The Pre-Proc task runs and has quick access to email headers:
jemhUtils.dropMessage('pre-proc task blocked '+fromAddress.getAddress()+' is blocked');
Script Field Processor
The Script Field Proc runs after all filtering, its important to ‘claim’ the processing of the mail, as shown here:
print("script field proc owning drop outcome");
resultMap.put("FORCE_JEMH_SCRIPTFP", true);
jemhUtils.dropMessage("field proc drop");
Project Mapping Script Rule
since 5.0.5
print('map rule testing');
result.setMatch(true);
jemhUtils.dropMessage('from: address '+fromAddress.getAddress()+' is blocked');
If HintOgrams are turned off, rejections will be treated as being forwarded.
Example Script
This could be used to reject a message if it contains a certain word within the subject:
if (subject.contains("reject")) {
jemhUtils.rejectMessage("Because I don't like the word reject!");
}
The above example produces the following results within the Processing Detail Report:
Enable Auditing by clicking Enable on the Auditing page to see these when running Test Cases and for previously processed mail
Email (HTML) received by the sender:
To customise the contents of these emails, please Use Template Sets (Custom Templates).
Further information
The documentation for each of the jemhUtils methods can be found here: