Spam Detect with Regex in Body


New Member
Nov 16, 2023
Hi all,

I'm encountering an issue while trying to set up spam filtering in Proxmox Mail Gateway using regular expressions to detect certain text in the body of emails.

My goal is to block incoming emails that contain a specific phone number (+480174621982) or a Skype name (maiboroda_alex) in the email body. I've attempted to set up a rule using the following regular expressions:
  1. For the phone number: .*\+480174621982.*
  2. For the Skype name: .*maiboroda_alex.*
I created a new "What Object" and a filter rule, where I specified 'body' in the "Field" and entered the above regular expressions in the "Value". However, it seems the rule is not functioning as expected. Emails that meet these criteria are not being blocked.

Could you please help me understand what I might be doing wrong? Are there specific steps or settings I need to follow to make this filter work correctly? Any advice or guidance would be greatly appreciated.

Thank you in advance for your assistance!
I may be wrong but I believe the Match field object only operates on message headers of which 'body' is not one.
For filtering based on the message body, you would need to create some custom spamassassin rules.
Thank you for your response. I'm indeed looking for a solution and I'm not sure where to look next. I'm dealing with a very persistent spammer whose emails always contain the same information - a specific phone number and Skype name, which I thought I could use to block the emails based on their content. However, I'm struggling to make this work. If you have any suggestions or guidance on how I might be able to set up effective filtering for this, it would be greatly appreciated.


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!