Rule

Rules

Name

The name of the rule. This can be anything you like.

Criteria

The criteria for this rule. Messages matching the criteria will be affected by the rule actions.
  • Use AND - All of the criterias must match for the message to be effected by the rule.
  • Use OR - If one criteria matches, the message will be effected by the rule.

Predefined field

  • From - The From MIME-header in the email message.
  • To - The To MIME-header in the email message. This should not be confused with the Recipient list setting. See notes (3) below for details.
  • CC - The CC MIME-header in the email message.
  • Recipient list - A list of all actual message recipients. This list is taken from the SMTP envelope, not from the MIME headers. See notes (3) below for details.
  • Subject - The Subject MIME-header of the email message.
  • Body - The Body of the email message. This includes both the plain text body and the HTML body.
  • Message size - The size of the message

Custom header field

If the header you want to filter on does not exist in the list of predefined fields, you can enter the name of the MIME-header in this field.

Search types

  • Equals - The value / string must match exactly
  • Not equals - The value / string must not match.
  • Contains - Partial match
  • Not contains - The value must not exist in the Predefined field / custom header field.
  • Less than - Can only be used for values
  • Greater than - Can only be used for values.
  • Regular expression - Use a regular expression to match the value.
  • Wildcard - Use a search string with wild cards to search for a value.

Value

Enter the value to search for, or a regular expression to use.

Test

Using the Test section in the Criteria dialog, you can test whether different values will match your criteria. If the value you have typed in matches the criteria, you will see the text Match next to the entered value. If not, you will see the text No match.

Actions

The action hMailServer should take when a message matches the rule criteria.
  • Delete email - The message will be deleted and not delivered to the recipient
  • Forward email - Forward the message to the specified address. The message will still be delivered to the original recipient
  • Move to IMAP folder - Move the message to a specific IMAP folder. This only applies when the delivery is local. If the folder does not already exist, it is created.
  • Reply - Reply to the sender with the specified message
  • Run function - Runs a function in the hMailServer script file.
    This function should take a hMailServer.Message object as parameter, for example Sub OnSomething(oMessage).
  • Set  header value - This action lets you create or modify an existing header value.
  • Stop rule processing - This action will cancel the remaining rules.
  • Send using route - Normally hMailServer uses recipient addresses to determine whether or not a route should be used. Using this rule action, you can override the default behaviour. As an example, you can set up a rule which instructs hMailServer to send all email being sent from a specific domain on to another server.

Notes

  1. It's possible to specify the macros %YEAR%, %MONTH% and %DAY% in the folder name parameter if Move to IMAP folder action has been selected.
  2. When searching for values in header fields, an empty string is treated in the same way as an nonexistent header. So if you set up a rule which will delete messages if the subject line is empty, it will delete lines where the Subject header does not exist as well.
  3. An email message normally have two lists of recipients. Knowledge about this is of importance when setting up rules to filter on the To header and Recipient list.

    The first list is the MIME recipients list. This list of recipient is the list you normally see in your email client, in the To and CC headers. The second list is the list in the MIME envelope - the MIME envelope contains the addresses where the email will actually be delivered. It's normally not possible to view this list in an email client. This means that an email can be sent to one address, but have other recipients in the To and CC headers. A common example on this is if you send an email and put someone in the BCC field. The address you enter in the BCC field will be added to the address list in the SMTP envelope, but will not be added to any MIME headers.

    When hMailServer forwards an email, the Recipient list (in the SMTP envelope) is updated. The recipient list in the MIME headers is not. This means that the recipient who receives the forwarded email message will see the original recipients in his email client.

Search documentation