Updated: 16 November 2026 · Applies to: DirectAdmin (Evolution skin) with Exim
To stop mail that contains a particular word, open SPAM Filters in DirectAdmin, choose the option to block messages containing a word, type the word and add it. From then on, any incoming message for that domain whose subject or body contains the word is caught by the filter. Pick the word carefully: the match is broad, as the tests further down show.
Steps
- Log in to DirectAdmin (usually
https://your-server:2222; the address is in your welcome email). - Open SPAM Filters (you can type its name in the menu search box). If you have several domains, select the domain that receives the unwanted mail.
- Choose the block-by-word option.
- Enter one word or short phrase, for example
casino, and add it. The filter appears in the list of active filters on the same page. - Repeat for each word you want to block. Each word is a separate filter.
According to DirectAdmin's changelog, filters on that page can either drop a matching message or send it to the spam folder. If your page offers that choice, the spam folder is the safer option while you are still testing a new word.
What the word filter checks
According to DirectAdmin, SPAM Filters are a basic Exim filter that acts on messages the server has already accepted, and the word search covers the message subject and body. A word filter applies to the whole domain, so it affects every mailbox on that domain, not only yours.
We tested a rule of this kind with Exim 4.98.2 in a lab container (Debian 13), checking a sample message with exim -bF. The rule used Exim's contains test on the subject and the body:
if $header_subject: contains "casino" or $message_body: contains "casino" then seen finish endif
Results from that lab test:
- Subject "Free casino bonus": caught.
- Subject "CASINO night": caught. The match ignores upper and lower case.
- Subject "Hello" with "casino" only in the body: caught.
- Subject "Casinos near you": caught. A word also matches inside a longer word.
- Subject "Invoice" with no match: delivered normally.
- "casino" placed after the first 700 characters of the body: not caught. Exim only looks at the first part of the body, set by
message_body_visible(500 characters by default; your server's setting may be different).
Output for a caught message:
Testing Exim filter file "filter" Seen finish Filtering set up at least one significant delivery or other action. No other deliveries will occur.
Output for a clean message:
Filtering did not set up a significant delivery. Normal delivery will occur.
The exact rule DirectAdmin writes for you may differ in detail, but the lesson is the same: a short word matches much more than you expect. Blocking sex, for example, would also catch "Sussex" and "Essex".
Choosing good words
- Use words or phrases that appear only in the spam you receive, such as an unusual product name or a phrase repeated in every copy.
- Avoid short or common words (
free,offer,win,loan). They match real mail from customers and suppliers. - A longer phrase such as
casino bonusis safer than a single word. - Spammers change spelling often ("c4sino"), so a word list needs looking after. For spam that varies a lot, SpamAssassin scoring works better than a list: see How to Enable Apache SpamAssassin in DirectAdmin for Spam Protection.
Related filters and undoing a mistake
- To block a whole sender domain instead of a word, see How to Block Emails from Specific Domains in DirectAdmin.
- To block very large messages, see How to Block Emails Based on Size in DirectAdmin.
- If a word filter is stopping real mail, delete it from the list: How to Remove Spam Filters in DirectAdmin. A message that was dropped (not sent to the spam folder) cannot be recovered.
- According to DirectAdmin, addresses on your SpamAssassin whitelist are also written into the domain's filter so they skip the SPAM Filters, which is a simple way to protect a sender whose mail keeps matching a word.
Official documentation: DirectAdmin, preventing spam.