|
|
|
|
|
|
|
|
|
|
Hacking Domino mail rules to fight spam (continued)
The rest of the Mailrule form is comprised of UI elements to help users create and validate the rules. Open names.nsf in Domino Designer and find the form with the alias Mailrule, it should be named (which is RulesDlg).
As you'll note from Figure C, mail rules are constructed by chaining together rule fragments with an operator (and/or).
FIGURE C
Here's the Domino Mailrule form design Click picture for a larger image.
Each fragment is composed of an attribute to examine in the condition field paired with a logical operator from the Logic field and a string (or other value) to compare against the condition. If you refer back to our medication example, it should become fairly obvious how values from Figure B map to the fields in Figure C and how these can be used to create the $FilterFormula we examined above. [By the way, we're using the term "medication" here rather than the drug's name, so we don't trigger all the mail filters when we transmit this article to you via email. -- Ed.]
Step 1: Customize the Mailrule form Let's concentrate on adding some values to the condition field as this will let us test message attributes that we normally can't get to. Open the properties of the condition field and select the control tab. You should see a number of choices already listed, as illustrated in Figure D.
FIGURE D
Add custom entries to Domino's mail rule form. Click picture for a larger image.
Add the following entries:
DNS Blacklist|J
Spam Assassin Score|K
Spam Assassin Report|L
Source IP|M
helo hostname|N
|
Look at options C, F and H in Figure D above; these are different from the other entries as they are based on numeric values (size in bytes, number of attachments and recipient count). These require different logical operators from the other string based choices, as does our custom Spam Assassin Score entry which will select a message based on the numerical "spaminess" score given to a message by Spam Assassin. To enable this differentiation, open the properties for the Logic field, and in the choices box, add the Spam Assassin Score entry to the condition list of the formula as illustrated in Figure E.
FIGURE E
Add new numeric conditions to the condition list of the Logic field. Click picture for a larger image.
Before you save the form with your changes, note that form's global options object uses a library called Rules. This LotusScript library is composed of quite a few LotusScript functions and is responsible for validating entries on the Mailrule form and for generating the final formula that gets put in the $FilterFormula field. Open the Rules library in Domino Designer by going to the Shared Code-> Script Libraries section of the database you are in.
Step 2: Add constants (and mappings) to the Rules library. Navigate to the (Declarations) object and add one constant for each new condition as depicted in Figure F, just increment the numeric value of each constant so that it is unique.
FIGURE F
Unique values are used to differentiate between conditions in the Rules library. Click picture for a larger image.
Move down to the FieldString function. This is where the relationship between the new conditions we added in the Mailrule form and the constants we added to the library's declarations are created. FieldString uses the alias of the selected option in the Mailrule form's condition field (shown above in Figure D) to get the value of one of the constants in the library's declarations. Simply add the appropriate case statements for new custom conditions as illustrated in Figure G. Every entry in Figure G must be based on a corresponding entry in Figure D.
[ Prev | Next ]
|
|
|
|
|
|
-- Advertisement --
AUTOMATE LOTUS NOTES USER ID MANAGEMENT
ID Manager 4.5 from HELP Software provides a new level of automaton for managing Lotus Notes IDs. ID Manager lets Lotus Notes administrators get out of the business of creating and managing user IDs. Use our ROI calculator to see how quickly ID Manager will pay for itself.
Learn more about HELP Software products
|
-- Advertisement --
The Ultimate Notes Domino Training Experience - Amsterdam, 11-13 November
Get in-depth technical training that you can put to use on the job right away at THE VIEW's Admin2008 and Lotus Developer2008 Europe! One registration gets you into your choice of over 70 new and updated expert know-how sessions, one-on-one consultations, hands-on labs, and more.
See complete agendas and register by 10 October to save 495 euros!
|
|
|
|
|
|
|
|
|