Custom filters — Explanation of the message filter fields


The following is a list of available fields you can add on the Message Filters page in your panel.

View the How do I enable message filters on my email address article for further details.

The following should be taken into consideration when creating filters:

  • Order matters! The rules are checked one by one, so be sure you have them listed in the order you want them to be checked or executed.
  • Most rules should end with "execute and stop". Only use "execute and continue" if you wish to do multiple actions to a single incoming email.

List of fields to add to your custom filter

Field Explanation Example


Looks in the Subject line of the email. It looks everywhere in the subject line, and can match part or all of the Subject.

  • match "drink" in "Subject: Eat, drink, and be merry!"


Looks in the From line of the email, checking for who sent the email. It looks everywhere in the From line, and can match part or all of the From line.
  • match "bob" in "From:"
  • match "Jones" in "From: Bob Jones <>"


Looks in the To line of the email, checking for whom the email was sent to. It starts searching directly after "To". Use '*' before your term to match any part of the name or email address anywhere in the line.
  • match "George" in "To: George of the Jungle <>"

Tip: Combine this rule with using '+' for slightly customized email addresses for easy sorting of emails from websites. Give Amazon your email address as and then you can easily filter those emails.

  • match "*books" in "To:"


Looks in the CC line(s) of the email, checking for other people the email was sent to. N/A


Looks at the beginning of every line in the email. Intended for use when matching header lines, such as "X-Spam: Yes". Note that this checks the entire email – the message body and the headers.
  • match "X-Spam: Yes" in the email's headers

Tip: use .* to match anywhere in the line, not just the beginning.

  • match ".*bananas" to match "bananas" anywhere in any line of the email


Looks in the Reply-To line of the email for the email address where replies to the email are sent. N/A


Looks in the message body of the email and does not look in the headers. N/A

Explanation of the ‘Do this’ action option fields

Field Explanation Example

Move it to folder

Puts the email in the specified folder. This is possibly the most useful action, but there are a few caveats/restrictions:

  • Folder names are cAsE sEnSiTiVe! Double-check your folder name's spelling and Shift key usage.
  • The filters cannot use folder names that have spaces in the name. Subfolders are okay, but must be specified with the parent folder and a '.', like ParentFolder.SubFolder. Folder names can only contain only letters, numbers, underscores, dots, and dashes. (But no leading dots, trailing dots, or double dots!)

Add this to the subject

Adds the specified text to the beginning of the email's subject line. "Subject: Test Email" becomes "Subject: ADDED_TEXT Test Email"

Add this header

Adds the specified text to the header area of the email. This added text will not be visible when the email is displayed normally – it will only be visible when viewing all the headers. N/A

Forward it to email address

The email address to forward to. This can be any address. N/A

Forward to shell account

Forward the email to the /Maildir directory of a shell user. This is the same as forwarding to You can control what happens to the email received by the shell user by creating a .forward.postfix file in your user's home directory.


The .forward.postfix file can have 644 permissions.

The file you want to run must have 755 permissions.

These examples show what to put into the .forward.postfix file in order to run a file when the email is received. Make sure to change username to your Shell user.

To run a bash script: 

"| /home/username/"

To run a PHP file script:

"| /usr/local/php72/bin/php /home/username/myscript.php"

Delete it

The email is not put in the Trash folder and is completely erased. N/A

Doing more than one action

Each individual message filter can check for multiple things but can only perform a single action. You can use "execute and continue" to have multiple actions done on a single email. When a filter has "execute and continue" the action from the matching filter is taken, and then the next filter is checked and filtering continues. Normally, filters are made with "execute and stop" and the first rule that matches is the only action taken, and no more filters are checked.

Here's an example set of filters that check for spam and also sort mail into folders:

  • add POSSIBLE SPAM to the subject of emails for any of the following:
-contains viagra in the Subject
-contains diet in the Subject
-contains monkey in the Subject
and then continue
  • move emails to Amazon with Amazon in the Subject
and then stop.
  • move emails to Twitter with in the From
and then stop.

A note on the forwarding rule

Forwarding will act very differently depending on the final ‘execute and stop’ or ‘execute and continue’ rule.

For example, a single filter set to:

  • forward and continue – forwards the email, after which a copy is also placed in your inbox.
  • forward and stop – ends the filter chain before it reaches the end, so no message would be placed in your inbox.

Using message filters with DreamHost spam filters

You can still use the message filters even if the domain is set up with Vade spam filters. Mail is filtered through the spam machines first, then gets routed to the regular incoming mail machines where your filters are then applied.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?