Using the Prepend rule action on messages with no subject


This article applies to:

  • MailMarshal SMTP
  • Rule action "Prepend text to message subject"

Question:

  • Want to add text such as "[External]" to all message subjects
  • How do I add warning text to the subject when the message has no Subject: header?

Background:

Many organizations use the MailMarshal "Prepend to subject" rule action on all incoming messages to tag messages as external. 

  • Current default rules for new installations include this rule in the "Business Email Compromise" policy.

If the message does not have a "Subject:" header the prepend action does not work.

Procedure:

To resolve this issue, you can add the missing header. This action can be applied in the same rule with the Prepend action.

  1. Edit the rule, and select the action "Rewrite message headers using expressions"
  2. Click to add the expressions.
  3. Add an expression named "insert subject"
  4. On the General tab, select the following:
    • field parsing method: Entire line
    • header fields: Subject
  5. On the Expressions tab, enter the following:
    • Field substitute: Insert if missing
    • Text:  [No subject]
    • NOTE: when entering the text, there must be a space before the [   (the first character in any “insert if missing” text must be a space)
If this action is added to the warning rule that is present by default in new installations, the rule will appear as follows:
When a message arrives,
And the message is incoming
Then rewrite message headers using 'insert subject'
  And prepend [EXTERNAL] to message subject
  And continue processing

Last Modified 2/19/2025.
https://support.trustwave.com/kb/KnowledgebaseArticle21234.aspx