Automated Mail Processing (Rules)

Intro
Installation
SysAdmin
Objects
Transfer 
Router 
Rules
SMTP 
UUCP 
Local 
RPOP 
LIST 
PIPE 
Access
Directory
Data Files
Clusters
WebMail
Miscellaneous
Licensing
HowTo
  • Specifying Account Rules
  • Creating, Renaming and Removing Rules
  • Rule Conditions
  • Rule Actions
  • Auto-Reply Message
  • Redirect All Simplified Rule
  • Logging Rules Activity
  • The CommuniGate Pro server can automatically process messages using several sets of Automated Rules.

    The Server-Wide Rules are applied to all messages submitted to the server. These Rules are applied by the Enqueuer kernel component, before it enqueues a message into the transfer module queue(s).

    When a message is directed to an account on the CommuniGate Pro Server, the Local Delivery module applies all Domain-Wide Rules to that message, and then it applies all the Rules specified for the target account.

    Each Rule has a name, priority, a set of conditions, and a set of "actions". The higher priority Rules are checked first.

    If a message meets all Rule conditions, the Rule actions are performed, and automated processing either stops, or proceeds checking other, lower-priority Rules.


    Specifying Account Rules

    The System administrator can specify Server-Wide Rules using the Rules Settings page.

    The System or Domain administrator can specify Domain-Wide Rules using a link on the Domain Settings page.

    The System administrator can specify Account Rules using a link on the Account Settings page.

    Account users can specify their Account-Level Rules themselves, via the WebUser Interface. The System or Domain administrator can specify which Rule actions each user is allowed to use.


    Creating, Renaming and Removing Rules

    When the list of Rules appears in a browser window, the Rule names and priorities can be modified:

     
    Priority Name Edit Delete
    Edit
    Edit
    Edit

    After you have modified the Rule names and/or priorities, click the Update button. The list is displayed re-sorted by priority.

    Rules with the disabled priority are not applied to the messages, but they are not deleted from the Account Rules set, and they can be reenabled at any moment.

    To create a new Rule, enter its name in the field on the top and click the Create New button.

    To remove a Rule, select the checkbox in the Delete column and click the Update button.

    To modify the Rule conditions and actions, click the Edit link.


    Rule Conditions

    Each Rule can have zero, one, or several conditions. The conditions are checked in the same order they are specified. If a message meets all the Rule conditions, the Rule actions are performed.

    The condition operations is and is not process their parameters as "pictures": the asterisk (*) symbols in parameters are processed as wildcards that match zero or more symbols in the tested string. To check that a string contains the @thatdomain substring, the is *@thatdomain* operation should be used, and to check that a string does not end with the somedomain.com substring, the is not *somedomain.com operation should be used.

    The condition operations in and not in process their parameters as sets of one or more "pictures" separated with the comma (,) symbols. The tested string is compared to all picture strings. The in condition is met if the tested string matches at least one picture string. The not in condition is met if the tested string does not match any picture string in the specified set.
    Note: do not use excessive spaces around the comma signs: spaces before the comma sign become trailing spaces of the previos picture, and spaces after the comma sign become leading spaces of the next picture.

    The following Rule conditions are implemented:

    From  [is | is not | in | not in]  string
    This condition checks that the message From address is (or is not) equal to the specified string.
    Sample:
    This condition will be met for all messages coming from any account on any of stalker.com subdomains.
    Sender    [is | is not | in | not in]  string
    Reply-To  [is | is not | in | not in]  string
    To        [is | is not | in | not in]  string
    Cc        [is | is not | in | not in]  string
    Reply-To  [is | is not | in | not in]  string
    The same as above, but the message Sender, Reply-To, To, or Cc address is checked.
    If a message has several addresses of the given type, the condition is met if it is true for at least one address. If a message has no addresses of the specified type, the condition is not met.
    Any To or Cc  [is | is not | in | not in]  string
    The same as above, but all message To AND Cc addresses are checked. If the message has no To/Cc addresses, the condition is not met.
    Each To or Cc  [is | is not | in | not in]  string
    All message To AND Cc addresses are checked. The condition is met if it is true for each To and Cc address of the message, or if the message has no To/Cc addresses.
    Sample:
    This condition will be met for messages where all To and CC addresses are addresses in the mycompany.com domain or addresses in the mydept.mycompany.com domain.
    Return-Path  [is | is not | in | not in]  string
    This condition compares the message "Return-Path" (a.k.a. MAIL FROM) envelope address with the specified string.
    'From' Name  [is | is not | in | not in]  string
    The same as above, but the instead of the address, the "address comment", i.e. the real name included in the From address is checked:
    Sample:
    This condition will be met for messages with the following From: addresses:
    From: jsmith@company.com (John J. Smith)
    From: "Bill J. Smith" b.smith@othercompany.com
    From: Susan J. Smith <susan@thirdcompany.com>
    Subject  [is | is not | in | not in]  string
    This condition checks if the message subject is (or is not) equal to the specified string.
    Sample:
    This condition will be met for messages with the following Subject fields:
    Subject: we urgently need your assistance
    Subject: Urgent!
    Message-ID  [is | is not | in | not in]  string
    This condition checks if the message ID is (or is not) equal to the specified string.
    Sample:
    This condition will be met for all messages without the Message-ID flag and for messages that have Message-ID without the @ sign.
    Message Size  [is | is not | less than | greater than]  number
    This condition checks if the message size is less than (or greater than) the specified number of bytes.
    Sample:
    This condition will be met for messages larger than 100 kilobytes.
    Human Generated
    This condition checks if the message is not generated by some automatic message generating software.
    It actually checks that the message header does not contain any of the following fields:
    Precedence: bulk
    Precedence: junk
    Precedence: list
    X-List*
    X-Mirror*
    X-Auto*
    X-Mailing-List
    This condition also checks that the message has a non-empty Return-Path.
    Header Field  [is | is not | in | not in]  string
    This condition checks if the message RFC822 header contains (or does not contain) the specified header field. The additional fields added using the Add Header operation (see below) are checked, too.
    Sample:
    Any Recipient  [is | is not | in | not in]  string
    This condition compares message "Envelope" addresses and the specified string. If this condition is used in an Account-level Rule, only the addresses routed to that account are checked.

    The addresses are processed in the form they had before the Router Table and other routing methods have modified them. If an account has several aliases, this condition allows you to check if a message was sent to a specific account alias.

    Messages can be submitted to the server using the ESMTP ORCPT parameter. This parameter specifies how the address was composed on the sending server, before the relaying/forwarding server has converted it to a different address. In this (rare) case, that server can use the ESMTP ORCPT parameter to specify the original address.

    Sample:
    • a message was composed somewhere and sent to the address user1@domain1.com;
    • the domain1.com server received the message and converted that envelope address to user2@domain2.com (mail forwarding);
    • the domain1.com server relayed the message to your CommuniGate Pro server domain2.com;
    • the domain2.com CommuniGate Pro server received a message;
    • the domain2.com CommuniGate Pro server found that the user2 is an alias of the user3 account, and the server routed the message to that user3 account.

    If the domain1.com server is an advanced server and informed the domain2.com CommuniGate Pro server that the original address was user1@domain1.com, the string <user1@domain1.com> is used when the Recipient condition is checked.

    If the domain1.com server has not informed your server about the original address, the <user2@domain2.com> string is used when the Recipient condition is checked.

    The condition is met if it is met for at least one envelope address.

    Each Recipient  [is | is not | in | not in]  string
    The same as above, but the condition is met only if it is met for all message envelope addresses (if used in an Account-Level Rule - for all message addresses routed to that account).
    Time Of Day   [is | is not | less than | greater than]  time string
    This condition checks the current time of day in the Server time zone. This condition allows you to compose rules that are applied to messages only at certain times of day.

    A time string should be specified as hh:mm or hh:mm:ss, where hh is the hour, mm - minutes, ss - seconds. Time strings can contain the am and pm suffices.

    Sample:

    Current Date   [is | is not | less than | greater than]  date string
    This condition checks the current time and date. This condition allows you to compose rules that are applied to messages only before or after the specified date and time.

    A date string should be specified in one of the following formats:

    • DD MM YYYY
    • DD MM YYYY hh:mm
    • DD MM YYYY hh:mm:ss
    • DD MM YYYY hh:mm:ss +ZZZZ
    • DD MM YYYY hh:mm:ss -ZZZZ
    where:
    DD is the day of month
    MM is month specified as 3-letter English abbreviation:
    Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
    YYYY is the year
    hh is the hour
    mm is the minute
    ss is the second
    +ZZZZ or -ZZZZ is the time zone; if the time zone is not specified, the Server time zone is used.

    Sample:

    Current Day   [is | is not | in | not in]  day string
    This condition checks the current day of week (using the Server local time zone). This condition allows you to compose rules that are applied to messages only on certain days of week.

    Days should be specified either as numbers (0 for Sunday, 6 for Saturday), or as RFC822 abbreviations (Sun, Mon, Tue, Wed, Thu, Fri, Sat).

    Sample:



    The following conditions can be used in Server-Wide Rules only:

    Any Route  [is | is not | in | not in]  string
    This condition checks that a message "Envelope" address is routed to the specified string.

    The condition is met if it is met for at least one envelope address.

    Note: only the "local part" of the parsed and routed address is checked. If, for example, an envelope address <user@client.com> was processed with the Router record

    client.com = relay.host.smtp
    then the envelope address (to be sent to a remote host relay.host) will have the local part user, not user@relay.host.

    If you plan to use this type of Rule condition, use the Test button on the WebAdmin Interface Router page to see how various addresses are routed.

    Each Route  [is | is not | in | not in]  string
    The same as above, but the condition is met only if it is met for all message envelope addresses.


    Rule Actions

    Each Rule can have zero, one, or several actions. If a message meets all the Rule conditions, the Rule actions are performed.

    The following Rule actions are implemented:

    Stop Processing
    This action should be the last one in a Rule. Execution of this Rule stops and no other (lower-priority) Rules are checked for that message. The message is stored in the INBOX.
     
    Discard
    This action should be the last one in a Rule. Execution of this Rule stops and no other (lower-priority) Rules are checked for that message. The message is not stored in the INBOX, but the positive Delivery Notification is sent back to the message sender (if requested).
    Sample:
    IF From is *that_annoying_guy@*
    THEN
    Discard

     
    Reject [error message text]
    This action should be the last one in a Rule. Execution of this Rule stops and no other (lower-priority) Rules are checked for that message. The message is rejected, and a negative Delivery Notification is sent back to the message sender.
    If the action parameter text is not empty, it is used as the error message text.
    You can still store the rejected message using the Store action before the Reject action.
    Sample:
    IF Subject is *UCE*
    THEN
    Reject   please do not send such messages here

     
    Mark operation [, operation...]
    This action sets or resets the specified flag(s) for the message. Initially, the set of message flags is empty.
    • The Read operation adds the Read (Seen) flag to the message flag set, the Unread operation removes the Read (Seen) flag.
    • The Flagged operation adds the Flagged flag to the message flag set, the Unflagged operation removes this flag.
    • The Answered operation adds the Answered flag to the message flag set, the Unanswered operation removes this flag.
    When a message is stored in a mailbox as a result of the Store in action, as well as when a message is stored in the INBOX after all Rules are applied, the message is stored with the specified flag set.
    Sample:
    IF Sender is *list*
    THEN
    Mark Flagged

     
    Add Headers header fields
    This action adds RFC822 header fields to the message. Initially, the set of additional message header field contains the Retrun-Path field generated using the return-path in the message envelope.
    When a message is stored in a mailbox as a result of the Store in action, as well as when a message is stored in the INBOX after all Rules are applied, the message is stored with the additional header fields.
    Sample:
    IF Subject is *purchase*order*
    THEN
    Add Headers X-Special-Processing: order

    Note: the following actions are not implicit "Discard" actions, and they do not prevent the original message from being stored in the INBOX. If you want, for example, to redirect a message without keeping a copy in your INBOX, specify the Redirect action followed with the Discard action.

    Store in mailbox name
    The message is copied to the specified mailbox in your account. The mailbox should already exist.
    If the mailbox name is specified as ~user_name/mailbox_name, the message is stored in the mailbox_name mailbox in the user_name account. You should have the Insert access right to that mailbox.
    Sample:
    IF Subject is *Make*$*
    THEN
    Store in ~postmaster/abuse
    Discard

    Redirect to addresses
    The message is redirected to one or several specified E-mail addresses. If several addresses are specified, they should be separated with the comma (,) sign.

    Forward to addresses
    The message is forwarded to the specified addresses. The From address is changed to this account address.

    Mirror to addresses
    The message is mirrored (redirected) to the specified addresses. Unlike the Redirect to operation, the Mirror-to operation does not change the message headers, only the Return-Receipt-to: and Errors-to: header fields (if any) are removed, and the X-Mirrored-by header field is added to the "mirrored" messages.

    Reply with message text
    The specified text is used to compose a reply message. The reply is sent to the address specified in the Reply-To address of the original message. If the Reply-To header is absent, the reply is sent to the original message From address.

    The header fields Subject: Re: original message subject and In-Reply-To: original message-ID are added to the reply message.

    The specified message text can contain macro symbols that are substituted with actual data when a reply message is composed:

    ^S is substituted with the Subject of the original message;
    ^F is substituted with the From address of the original message;
    ^T is substituted with the Date field of the original message;
    ^I is substituted with the Message-ID field of the original message.
    Sample:
    Reply with
    If the specified message text starts with the '+' sign, the lines following this sign are added to the message header. The text should specify the Subject field, since the system will not automatically add the Subject: Re: original subject and In-Reply-To: original message-ID fields into the reply message.

    Additional headers can contain additional To, Cc, and Bcc fields and the reply message will be sent to those addresses (the Bcc fields will be removed from the message headers).

    The ^S and other macro symbols can be used in the additional headers, too.

    An empty line should separate the message body from the additional header fields:

    Reply with

    Reply to All with message text
    The same as above, but the reply is sent to all addresses listed in the original message To: and Cc: fields.

    React with message text
    The specified message text should contain a header, an empty line, and the message body. The header should contain any number of To, Cc, and Bcc fields, the Subject field, as well as any number of additional fields. The composed message is sent to the specified addresses. The system uses the account address to compose the From field for these reaction messages.

    The specified message header and the message body can contain macro symbols listed above.

    Sample:
    React with

    Execute command line
    The specified command is executed in a separate OS process (task).

    The message text (the header and the body) is sent to the task as that task standard input (stdin).
    Note: the task must read the entire stdin data stream, otherwise the Execute command fails.

    When the task completes, the task exit code is checked. If it was zero, the Rule action is considered to be executed successfully, and the next Rule action is executed.

    If the task exit code is non-zero, the message is rejected with the error code "automated processing failed", and the data from the task standard error channel is recorded in the Log along with the task exit code.

    The data from the task standard output, if any, should not exceed 4Kbytes in size. It is recorded in the Log and discarded.

    The CommuniGate Pro Server monitors the task during its execution, and it interrupts the task if it does not complete in 2 minutes.

    When a task is to be executed as a part of Account-level Rule processing, the OS User Name is composed using the OS User Name setting for the account domain, and the task is executed in that OS User Environment.

    For Unix systems, this means that the task is assigned the specified OS User ID, group ID, and the set of groups; the task current directory is set to the OS User home directory.

    When a task is to be executed as a part of a Server-Wide Rule, it is launched in the CommuniGate Pro Server own environment (with the base directory being the current directory).

    Sample:
    Execute

    FingerNotify [ address ]
    The Server connects to the computer at the specified network address, port 79 (the finger port), and sends the nm_notifyuser string to that computer. If the address is not specified, and the action is executed as a part of an Account-Level Rule, the network address of the last user Login is used.

    This action should be used with the NotifyMail® utility installed on client computers.

    Sample:
    FingerNotify

    Users are allowed to specify this action only if they are allowed to specify execute-type actions.

    Write To Log string
    A Major-Level (Level 2) record with the message ID and the specified string is placed into the System Log.

    Only the Server Administrator is allowed to specify this action.


    Auto-Reply Message

    Each Account has one built-in rule to generate Auto-Reply messages.

    This Rule condition is human generated, the Rule action is Reply. Only the text of the Reply message can be modified:

    Auto-Reply
    Auto-Reply
    If this option is not selected the Auto-Reply Message Rule is disabled. If this option is selected, the Auto-Reply Message Rule is enabled with the lowest priority.

    Even if the Administrator has not allowed the user to specify Automated Rules, the Auto-Reply Message can be enabled by the user herself, and the user can always modify the Auto-Reply Message text.


    Redirect All Simplified Rule

    Each Account can have a simplified rule to redirect all incoming mail to a different address or addresses.

    This Rule condition is either empty (the Rule action is applied to all messages) or, optionally, human generated, the Rule actions are Redirect To and, optionally, Discard.

    Only the list of redirection addresses can be modified:

    Redirect All Mail to:
    Keep a Copy Do not Redirect Automatic Messages

    Redirect All Mail to
    If this option is not selected the Redirect All Rule is disabled. If this option is selected, the Redirect All Rule is enabled with the lowest priority.

    Keep a Copy
    If this option is not selected, the action Discard is added to the Rule and all redirected messages are NOT stored in the account INBOX.

    Do not Redirect Automatic Messages
    If this option is selected, the condition Human Generated is added to the Rule and messages from non-human sources (mailing list messages, error messages, redirected and mirrored messages) are not processed with this Rule.

    The account user can set this Rule only if the Account is granted a right to specify the redirecting Rule actions. Otherwise only the Administrator can set this Rule for the user account.


    Logging Rules Activity

    The Enqueuer component records Server-Wide Rules activity in the Log. Set the Enqueuer Log Level to Low-Level or All Info to see the Rules checked and the actions executed.

    The Local Delivery module records Domain-Wide and Account-Level Rules activity in the Log. Set the Local Delivery module Log Level to Low-Level or All Info to see the Rules checked and the actions executed.


    CommuniGate® Pro Guide. Copyright © 1998-2000, Stalker Software, Inc.