• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Bounce/block spam based on keyword in subject?

Pleskie

Regular Pleskian
Lately I have been receiving quite a lot of spam on a daily basis. I think the spam comes from one and the same sender / 'company'.

I use the blacklist in the (server wide) mail settings to block the sender domains, but they seem to have bought a lot of different domains (mainly ending on .cam or .work) so each day I keep receiving 1 or 2 spam mails send from a domain which I have not yet blacklisted.

I would like to know if it is possible to block spam mails based on their subject. For example: block a mail if the subject contains 'bitcoin'.

I know spam-software is available where you can set a spam-score of 100 if the subject contains a specific word. Based on the spam-score you can choose if an email should be deleted or moved to a spam folder. If I use a solution like this and choose to delete mails based on their spam-score it might result in deleting mails that look like spam but are actually valid. Of course I could choose instead to move the mail to the spam folder, but then I would still have to check and empty my spam folder each day. I do not like this way of working.

What I would like is to not work with a spam-score, but simply block/bounce/remove an email from the server if the subject contains a specific word. Is there a (preferably free) plesk extension or other tool that does exactly that?
 
You could either create (a) custom SpamAssassin rule(s) to move emails that match your rules criteria to the spam folder of an email account. Setting a spam score thats higher than your spamfilter tresshold. Something like:
Code:
header      SPAM_BITCOIN Subject=~ /Bitcoin/i
score       SPAM_BITCOIN 15.0
describe    SPAM_BITCOIN Move to spam folder

Or if you only want to filter out emails from send from domains with certain TLD's and the bitcoin in the subject.
Code:
header        __SPAM_BITCOIN_TLD From:addr =~ /@[a-z0-9\-\.]+\.(cam|work)/i
header        __SPAM_BITCOIN_SUBJECT Subject=~ /Bitcoin/i

meta         ( __SPAM_BITCOIN_TLD && __SPAM_BITCOIN_SUBJECT )
score        SPAM_BITCOIN 15.0
describe     SPAM_BITCOIN Move to spam folder

Or you try to configure Postfix to reject certain emails that match certain patterns. You could use the header_checks methode to set a pattern for a subject. See Postfix manual - header_checks(5). Something like
Code:
/^Subject:(.*) bitcoin /     REJECT No bitcoin spam please!
 
Last edited:
Thanks for your reply.

I was hoping for an easier solution like an extension so I can configure it easily through Plesk Panel.

Is this the only way to go?
 
Grateful for your response.

I sought a simpler fix, such as a Plesk Panel extension for easy configuration. Is this the sole path?
 
Back
Top