...
Below is some additional information and examples about what can be achieved within a Script Rule.
Script Context
API | Notes |
---|---|
| Get body content of email. Not available for preprocessing task. |
| Gets the Subject content of email. |
| Get all headers of a message. |
| Get value of a message header Parameters
|
| Set the value of a message header Parameters
|
| Adds output that is recorded during execution and shown in the processing report. Parameters
|
| Set the processing outcome of the script Parameters
Note: |
| Field processor and Script Rule only. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map |
| Searches within string values for matching content.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp |
| This is used to define that the script rule is a match. This will result in that Rule and Project being used to process the email. |
Examples
Match a keyword in the email body using a regular expression
...
Code Block |
---|
MIME-Version: 1.0 Received: by 10.223.112.12 with HTTP; Sat, 18 Jun 2011 22:42:26 -0700 (PDT) Date: Sun, 19 Jun 2011 17:42:26 +1200 Subject: This is the email subject From: ryan@thepluginpeople.com To: test@test.com Example: Example Value Content-Type: text/plain; charset=UTF-8 This is an example email example: 100 |
Processing Report
...
Info |
---|
Note regarding retrieving specific headers:
|
Reject mail using script rule
To reject using script rule, you can define setOutcome
, specifying the outcome
and reason
for the outcome.
Current available outcomes are: IGNORE
, DROP
, and FORWARD
Example
Code Block |
---|
setOutcome('IGNORE','Reason for reject outcome goes here') |
Setting Custom Field Values via Script
...