Mailtraq - the Complete Email Server
   

Enstar for Mailtraq email server sales & support
Making world-class Internet technology affordable  

Search for:

Advanced search

KB09092301 Scripting example

This worksheet is an example of how to use scripting in Mailtraq.

The example shows how to change the domain name generated by, in this case, a mailing-list.

Outline
The procedure is in two parts: first - write the script; second - define the trigger.
The scripting controls are accessed from the Console | Options | Scripts and Templates

Create the script
Open the Scripts and Templates dialog, select the Scripts-tab and click the [New] button.
Enter your script in the window that opens - for example:

// New Script
// Lines beginning with double forward slashes are comments
<@LANGUAGE=Javascript@>
<%
 if (Request.GetHeader("From").match("test@domain.com"))
 Request.SetHeader("From", "The Test Account <test@change.com>");
 %>

Then 'Save' - the script will have a name - 'change' in this example.

Set the Trigger - Part 1
Select the Automated Scripting-tab
Select the Script you want to trigger - 'change', in this example.
Set the Script Trigger

Set the Trigger - Part 2
Select the Message Trigger-tab
Set to, say, All Messages
Set when the script will be applied.
     For example: 
     Outbound Mail Delivery - the script will only be applied to messages leaving the server (not local).
     Mail Routing - the script will be applied to all messages.
Set the 'Script will modify the message' control.

The script activation is set by the 'Enable this Script' control.

Testing
When you are testing your script make sure that you are testing under the correct conditions - for example, if your script is applied only on Outbound Mail Delivery you will need to check the receipt of the message on a remote mail server you have access to - say your personal email.


Keywords: kb scripting
Mailtraq Highlights...
 SMTP Server     Mailtraq SMTP email server video IMAP Server     Mailtraq IMAP email Server video
 POP3 Server     Mailtraq POP3 email server video Proxy Server     Mailtraq proxy email server video
 Webmail Server     Mailtraq webmail email server video Mailing-list Server     Mailing list email server video
 Groupware Services     Mailtraq groupware email services video Spam and Virus control     Spam and virus control email server video

 

   Copyright © 2003 - 2011 Enstar Ltd, Enstar LLC & Fastraq Ltd. All rights reserved. Privacy policy.
   Mailtraq® is a registered trademark of Fastraq Limited.