Skip to main content
Version: 1.4

Rules tester

The Rules Tester lets you simulate the mail flow and verify how your configured rules behave - without sending any real emails. Provide a sample message with a sender, recipients, subject, and other attributes, and the application will process it through your rules exactly as it would during live operation. The results show which rules matched, which conditions were evaluated, and what actions would be applied.

The list keeps the test messages you have sent, with their sent date, sender, recipients, subject and status. Click a message to see its processing details, use Reply... to compose a reply to it, and Remove selected or Remove All to clean up the list. Reset counters starts the sending limit counters of the Rules Tester from zero, see SMTP.

The Rules Tester page, with the New message menu, the Reply, Remove selected and Remove All buttons, and a sent internal test message in the list

The tester follows the switches of the rules processing page as they are saved, as the milter does: while processing is switched off, a test message passes through unchanged, and a rule type that is switched off is skipped.

New message​

The New message menu offers:

  • Random incoming..., Random internal..., Random outgoing... - pre-fill a test message of the given direction with random data, using addresses from the synced directory.
  • Custom... - start with an empty message.

Test message compose​

The form has six tabs: Message, Details, SMTP, Attachments, Headers and Scripts.

The New test message form on its Message tab, with the From, To and Subject fields, the Html or Text body type and the body editor

Message​

  • From - the sender's email address. Use the User... button to pick from existing users.
  • To - recipient email addresses. Multiple recipients can be added. Use the User... button to select from existing users.
  • Subject - the message subject.
  • Body - the message body, written as Text or as Html, with basic formatting options for Html.

The address fields take name@domain or "Name" <name@domain>, several separated by commas or semicolons. A comma or semicolon inside a quoted name belongs to the name, so "Chan, Matthew" <matthew.chan@example.com> is one recipient. A list pasted from Outlook, such as Doe, John <john@example.com>; Roe, Jane <jane@example.com>, is read as two recipients with their names, and a pasted column of addresses, one per line, is read too.

A message written as Text is sent as plain text only - a single text/plain body, or multipart/mixed with the text and the attachments - so rules for plain-text mail can be tried. A message written as Html carries both the Html and a text alternative.

Details​

The Details tab of a test message, with the sent date and time, the Cc and Bcc fields and the Protection choice

  • Sent date - the date and time the message is considered to be sent.
  • Cc, Bcc - further recipients, in the same form as To.
  • Protection - sends the test message as signed or encrypted: None, Signed (S/MIME), Signed (PGP/MIME), Signed, opaque (S/MIME), Encrypted (S/MIME) or Encrypted (PGP/MIME). The message gets the MIME structure of such mail with placeholder bytes instead of a real signature or ciphertext, which is all the rules look at, so the Message type condition with Signed or Encrypted and the actions that leave protected mail alone (signature, disclaimer, add, strip and remove attachments) can be tried without keys or certificates. For an opaque signature or an encrypted message the body and the attachments cannot be edited: they would be inside the ciphertext, where rules cannot see them either.

SMTP​

The SMTP tab takes what the mail server tells the milter about the connection, so the SMTP rules, the sending limits and the DKIM result condition can be tried. Every field is optional.

FieldMeaning
Client addressThe IP address of the connecting client, IPv4 or IPv6. Empty: mail handed over locally.
Client host nameThe reverse DNS name of the client address. Empty: the address has none.
Server portThe port the client connected to: 25 for incoming mail, 587 or 465 for submission.
HELO nameThe name the client gave in HELO or EHLO.
Authenticated accountThe account the client logged in with. Empty: the client did not log in.
Envelope sender (MAIL FROM)Empty takes the address in From; type <> to test a bounce.
Envelope recipients (RCPT TO)Empty takes everyone in To, Cc and Bcc.
Message size (KB)The size the size limits count. Empty: the size of the message as composed.
DKIM resultThe result the DKIM verification would have found before the rules changed the message: pass, fail, temperror or none. Not checked (DKIM verification off) by default.
DKIM signing domainThe domain of the signature. Empty: the domain of From.

The tab keeps the values of the last test message you sent, so a series of tests on the same connection needs them only once.

On Send the SMTP rules decide first, stage by stage and about every recipient, as in the milter. The message rules then run with the recipients that are left. A message whose connection or sender was refused does not reach the message rules at all.

The sending limits count in counters of the Rules Tester's own, so tests never use up the limits of the servers. Reset counters in the toolbar of the Rules Tester starts them from zero.

Attachments​

The Attachments tab of a test message, with the Upload files and Remove buttons and the list of files with their content type and size

Files to attach to the test message, for testing attachment-related conditions and actions. The test message carries the uploaded file itself, so conditions that look into attachments - Archive content, Attachment encrypted, External script - give the same answer as in the milter, and the Before and After .eml files hold the file too. A test attachment can be up to 10 MB, like the stored attachments; a larger file is not added and the tester says so.

Headers​

The Headers tab of a test message, with the Add, Edit and Remove buttons and the list of header names and values

Custom message headers to add to the test message.

Scripts​

The Scripts tab of a test message, with the Simulated script exit code and Simulated script output fields

The tester does not run the scripts of External script conditions; they get the Simulated script exit code (0 by default) and Simulated script output given here instead. Tick Run the scripts on this server instead to run them for real with the test message - available only when the web app was started with a scripts directory, which is the case unless SCRIPTS_DIR is empty.

Send​

Once the message is ready, click Send to run it through the rules engine and see the results. Send checks the address fields first and marks one whose entry is not an address - for example a name without angle brackets, "Chan, Matthew" matthew.chan@example.com - with the format to use, or an empty From.

Test message details​

A sent test message on its After processing tab, with the status, sent date, size, sender, recipients and subject, and the Html body with the signature and disclaimer the rules added

Click a sent message to see its details: the sender, recipients and subject, with its protection shown under the subject, the processing trace, and the message before and after processing. The body shows only the formats the message has, so a text-only message opens on its Text view. A sent Text message opens as Text again in Reply....

The SMTP tab of the details shows the connection the message was tested with - a field left empty reads Not sent - and the decision for each recipient:

ColumnShows
RecipientThe envelope recipient
SMTP rulesAccepted, Refused, or Deferred for a temporary refusal
RuleThe SMTP rule that refused it
ReplyThe reply the client would get, for example 550 5.7.1 Command rejected

The Processing trace starts with what the SMTP rules decided at each stage, followed by the trace of the message rules.

Html preview​

The Html view of a test message is a preview drawn by the Rules Tester, not by a mail client, and a line above it says so. Mail clients render Html differently: Outlook on the desktop uses the Word engine, webmail clients rewrite and wrap the body and may drop styles, phone apps rescale the message, dark mode changes colours and remote images stay blocked until the recipient allows them. A signature or disclaimer that looks broken, or perfect, in the preview can therefore look different in the mailbox. The preview is shown inside the web page, whose own styles can also affect it. To check the final look, send a real message through the server to a Zimbra, Outlook and Gmail mailbox, and open it on a phone as well. The Text view shows the plain text exactly as it is sent.