Stopping spam from the MX filter in reply to field


Well-Known Member
Nov 23, 2011
I have an odd issue that I am trying to figure out how to resolve.

In the logs, my customer got this email (spam / phising)

Dec 2 11:10:20 swarmx1 postfix/smtpd[155817]: connect from[]
Dec 2 11:10:21 swarmx1 postfix/smtpd[155817]: Anonymous TLS connection established from[]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
Dec 2 11:10:21 swarmx1 postfix/smtpd[155817]: 80C2C2A037A:[]
Dec 2 11:10:21 swarmx1 postfix/cleanup[158447]: 80C2C2A037A: message-id=<>
Dec 2 11:10:21 swarmx1 postfix/qmgr[513]: 80C2C2A037A: from=<>, size=49711, nrcpt=1 (queue active)
Dec 2 11:10:21 swarmx1 pmg-smtp-filter[158468]: 2611A85FC7BC6DDCD60: new mail message-id=<>#012
Dec 2 11:10:21 swarmx1 postfix/smtpd[155817]: disconnect from[] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
Dec 2 11:10:24 swarmx1 pmg-smtp-filter[158468]: 2611A85FC7BC6DDCD60: SA score=0/5 time=2.110 bayes=0.00 autolearn=no autolearn_force=no hits=BAYES_00(-1.9),DKIM_SIGNED(0.1),DKIM_VALID(-0.1),DKIM_VALID_AU(-0.1),DKIM_VALID_EF(-0.1),HTML_MESSAGE(0.001),RCVD_IN_PSBL(2.7),SPF_HELO_PASS(-0.001),SPF_PASS(-0.001)
Dec 2 11:10:24 swarmx1 postfix/smtpd[158002]: connect from localhost[]
Dec 2 11:10:24 swarmx1 postfix/smtpd[158002]: 3A31A2A035E: client=localhost[],[]
Dec 2 11:10:24 swarmx1 postfix/cleanup[158447]: 3A31A2A035E: message-id=<>
Dec 2 11:10:24 swarmx1 postfix/qmgr[513]: 3A31A2A035E: from=<>, size=50640, nrcpt=1 (queue active)
Dec 2 11:10:24 swarmx1 postfix/smtpd[158002]: disconnect from localhost[] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
Dec 2 11:10:24 swarmx1 pmg-smtp-filter[158468]: 2611A85FC7BC6DDCD60: accept mail to <> (3A31A2A035E) (rule: default-accept)
Dec 2 11:10:24 swarmx1 pmg-smtp-filter[158468]: 2611A85FC7BC6DDCD60: processing time: 2.338 seconds (2.11, 0.191, 0)
Dec 2 11:10:24 swarmx1 postfix/lmtp[157876]: 80C2C2A037A: to=<>, relay=[]:10024, delay=2.8, delays=0.48/0/0/2.3, dsn=2.5.0, status=sent (250 2.5.0 OK (2611A85FC7BC6DDCD60))
Dec 2 11:10:24 swarmx1 postfix/qmgr[513]: 80C2C2A037A: removed
Dec 2 11:10:24 swarmx1 postfix/smtp[158385]: 3A31A2A035E: to=<>, relay=[]:25, delay=0.07, delays=0.01/0/0.05/0.02, dsn=2.0.0, status=sent (250 Mail queued for delivery)
Dec 2 11:10:24 swarmx1 postfix/qmgr[513]: 3A31A2A035E: removed

The "reply to" email is set to:

swarmx1 and swarmx2 in this case are my PMG servers. How can I block emails like this getting through to customers? The fact that the reply to is a legit domain for the PMG servers is a little alarming. Can anyone thing of a way to stop this sort of email from coming in? Blocking the main domain spamming would be one thing but its a temporary solution. Ideally, I'd like to block anything that has a reply to that points back to these servers.

Hopefully this makes sense. Thanks!
I have been working for the past month on improving how proxmox is filtering mail for our company. The default installation is very conservative and you need to take additional steps to ensure malicious mail is blocked. Before we had barracuda filter that was good but again has it's own drawbacks. I can say that after fine tuning proxmox specifically for our environment we are now on par with barracuda spam filtering and that is good news. Still working on how to improve malicious attachments detection/removal because the default filters are not very good.

First thing I started doing is checking if the servers from where I am getting mail are on any DNSBL block list. Using DNSBL is very controversial topic ( but I find them to be very good for our mail flow size. False positives are very low. You need to check this as soon as you get your spam as this is a new infected server and it might not be on any block list at the start of spamming. You will soon notice that the servers get added first on the same sites over and over again so I selected the DNSBL sites below.
Normally I use and for checking IP addresses.

Depending on the size of your mail flow you may need to use another method of querying DNSBL sites. We don't have much mail flow so using DNS is fine. Before using anything do your own research and learn about what you are going to use.

After checking for a while I settled on using: (make sure to register your server on ( read and understand why you should use it) (again read and try to understand why should you use it) (same here (and here (this might give you some false positive read below about how to add exclusions

This is what works for us and does not mean it will work for you. I am also setting DNSBL Threshold to 1 and that is considered very aggressive but it works for us.
Also I am using SPF checking.

To add exclusions you can add them on Whitelist

After you add a new exclusion make sure to restart the postfix service or the exclusion won't work. It's a bug it looks like.

Normally when I try to add exclusions the way that I check for sending domain what kind of IP pools they use is to check SPF on the domain (if they have one) and add them as exclusions. Using you get a really nice display of network blocks that you can add to whitelist. It's way better to add safe networks then domains because domains can be spoofed IP addresses can't be.

For example to find out google (gmail IP servers blocks) on dmarcanalyzer you get this:

Also looking on RIPE database I managed to collect IP pools for major providers that I added to whitelist.

Apple ( in (very hard to find out they don't show ip pools via spf) ripe helps a bit...

paypal (the main three servers)

After adding this we had extremely low false positive and if someone is trying to send something from domains added on whitelist and is coming from different IP I know it's spoofed from address and bad mail.

The next part is configuring the Spam Detector filter. Again the default settings are very conservative. I have also set as a distribution group and added as much addresses as I seen on our filter that spam is being delivered to them and they do not exist. I want to receive bad email so I can analyze the headers and the content of the email. I also added myself to and so I can see what kind of spam they receive. More spam mail you can check the better modifications you can make.

You don't want to modify something without making sure you know what you are doing. Also this works for us and it might not work for you. Do your own work/research before adding something...

When you receive bad mail check the headers what they are saying for example in outlook you open mail and do File - Properties - Internet headers
What is important to you is X-SPAM-LEVEL part of the source (example of bad mail):
X-SPAM-LEVEL: Spam detection results: 0
BAYES_00 -1.9 Bayes spam probability is 0 to 1%
DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid
DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
HTML_IMAGE_RATIO_08 0.001 HTML has a low ratio of text to image area
HTML_MESSAGE 0.001 HTML included in message
MIME_HTML_ONLY 0.1 Message only has text/html MIME parts
RCVD_IN_DNSWL_LOW -0.7 Sender listed at, low trust
RCVD_IN_MSPIKE_H4 0.001 Very Good reputation (+4)
RCVD_IN_MSPIKE_WL 0.001 Mailspike good senders
SPF_HELO_PASS -0.001 SPF: HELO matches SPF record
SPF_SOFTFAIL 0.665 SPF: sender does not match SPF record (softfail)
T_LOTTO_AGENT_FM 0.01 Claims Agent

On our filter we have set that if the score is 3 than it will add in the subject "Unwanted e-mail - SPAM" and if it's higher than 4 then it will block email. Again it depends on your environment how you setup so this works for us but it might not work for you.

The only two scores that I can modify from this list are SPF_SOFTFAIL and T_LOTTO_AGENT_FM and I did modify them in a way that it will block this kind of messages in the future. I set SPF_SOFTFAIL to score 4 and T_LOTTO_AGENT_FM to score 2 so in the future this mail would be blocked.

You need to check before on your filter what kind of mail is getting this detection results and how will you modify the score properly. Do your own research before using this methods.


You can search by anything in the log and that is good way to check before you add anything or how are you doing. Use the tools to your own advantage.

Here is how I set up our current Custom Scores for our environment. I know that in the manual it says that it's not recommended to make major changes to the scores but this seems the only way to block spam effectively. It depends highly on the size of your mail flow and how smart are you will adding scores. For now I had very low false positive and I adjusted the scores accordingly.

Make your own research and actually check messages before you make any changes to your system. What I have setup is tailored for our mail flow specifically. Don't blame me if you use my settings and your mail is getting blocked. Do your own research.

I am testing KAM_DMARC_REJECT and SPF_FAIL high score and for now it seems to be working fine.


If you want to add exclusions you can add them to Whitelist but be careful. Whatever you add here will mean that it will not be checked by the spam filter so keep that in mind!

You can check your whitelisted messages by searching for "rule: Whitelist"
I am at the limit of 10 attachments in the forums so no image here..

The last thing I am working on is how I will remove attachments that are not allowed. I already made a post but it's not approved yet on the forum.

Hope this is somehow helpful for you and as I said this works for us but it might not work for you. Do your own research before doing anything. I take no responsibility for the lost mail if you use the methods described in this post.


  • 1607117447240.png
    65.6 KB · Views: 74
Last edited:
Nice post but the most effective way to reduce SPAM is first to configure DKIM for all domain that your server relays for. Then make sure to only allow email from incoming and outgoing secure connections (TLS). The Verify Receivers (550) will drop emails to aliases and contacts so 450 is a better choice. Also enable greylisting. Any legitimate server will retry and understand the graylisting response.


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!