• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question Do not forward spam emails to external mailbox

Talistech

Basic Pleskian
Server operating system version
Ubuntu 22.04.2 LTS
Plesk version and microupdate number
Version 18.0.52 Update #3
Hi,

Some of our customers are using e-mail forwarding to their personal mailboxes like Yandex, Hotmail or Gmail.
When I check our mail logs I see a lot of incoming spam to our servers (which are marked as SPAM, no issue there)

But is there any way to deny forwarding for spam mails? At this moment, ALL mails are being forwarded, I only want to forward non-spam emails. Can this be done?

Thank you,
Mustafa
 
The forward happens before mails are being processed by the spam filter. DNSBL configuration applies, but not antivirus or spam software.
 
The forward happens before mails are being processed by the spam filter. DNSBL configuration applies, but not antivirus or spam software.
Exactly, that's why I wanted to ask you guys.
Is there any possibility we can try? Or anything you can suggest I could try?
 
I think there used to be a Plesk knowledgebase article explaining how SpamAssassin could also be used for filtering outbound email. I used it once on server a couple of years back. But I don't seem to be able to find the knowledgebase article andI don't remember the steps involved.

But outbound spam filtering probably the way to go. Either with SpamAssassin or something like SpamExperts (or something else).
 
I think there used to be a Plesk knowledgebase article explaining how SpamAssassin could also be used for filtering outbound email. I used it once on server a couple of years back. But I don't seem to be able to find the knowledgebase article andI don't remember the steps involved.

But outbound spam filtering probably the way to go. Either with SpamAssassin or something like SpamExperts (or something else).

Thank you, I'll give that a try.
 
For anyone else having this issue, I resolved my isssue it with Postfix header checks.
Since all spam mails are marked with "****SPAM*****" by Spamassassin when they're incoming, I'm simly dropping all outgoing messagedd with "SPAM" in the content.

Bash:
# Install postfix-pcre
sudo apt install postfix-pcre

# Check if it is available
postconf -m

# Open the postfix configuration file
vim /etc/postfix/main.cf

# Add this to the bottom of that file
header_checks = pcre:/etc/postfix/header_checks


# Then you want to create the file we just added to the config
vim /etc/postfix/header_checks

# And add this to the content
/SPAM/     DISCARD


# After creating that file, you need to build the index file and restart postfix
sudo postmap /etc/postfix/header_checks
sudo systemctl restart postfix

Test it by sending a mail to an external mailbox. And then send the same mail with "SPAM" in the subject, it should not be sent.
 
cat /var/log/maillog
Code:
Jun  9 09:31:15 **** psa-pc-remote[3985528]: 462D61C1208: from=<****@****.com> to=<****@****.io>
Jun  9 09:31:15 **** postfix/cleanup[1142774]: 462D61C1208: discard: header Subject: SPAM from localhost[127.0.0.1]; from=<****@****.com> to=<****@****.io> proto=ESMTP helo=<webmail.****.****>
 
[..]

# Then you want to create the file we just added to the config
vim /etc/postfix/header_checks

# And add this to the content
/SPAM/ DISCARD

[..]
This perfectly blocks A LOT of mails.
Also the none-redirected mails with Header

Code:
header X-Spam-Flag: NO

which e.g. applies to GMX mails. Funny.
 
Make sure to check if postfix-pcre is already active before installing the postfix-pcre package. It needs to be the same version as the postfix package. Otherwise, the installer tries to downgrade the installed postfix version to the same version as the postfix-pcre package.

On AlmaLinux 8, it's already part of the postfix package:
Code:
# postconf -m | grep pcre
pcre
 
Back
Top