Mailscanner on cPanel, send spam to spam/junk folder globally

Peter Lemieux mailscanner at
Wed Dec 16 16:53:46 UTC 2020

Don't know anything about CPanel, but if your SMTP servers use the 
popular Mail Delivery Agent procmail, then you can write a "recipe" and 
put it in /etc/procmailrc that will look for "{Spam?}" in the Subject 
line and route the offending message to /home/$USER/mail/likely-spam or 
wherever you prefer.  Something like this (untested):

# File: /etc/procmailrc
# route all mail with "{Spam?}" header to user's spam box
* ^Subject:.*\{Spam

The message is scanned by root but delivered, I believe, to the 
recipient's spam folder (here in mbox format).

See "man procmailrc" and especially "man procmailex" for examples.


On 12/15/20 4:36 PM, Donato Pisani wrote:
> Hello everyone,
> I hope you are fine.
> I am having some problems with mailscanner inside a server with cPanel.
> Mailscanner adds the message "{Spam?}" to the subject of the message and leaves it in inbox, I know that with a filter in each account generated by cPanel I can make it send to another folder if the subject contains that phrase, but it becomes unsustainable when there are too many accounts on the server.
> Is there a way to filter globally for existing and new domains?
> Thank you a lot for your time and help!

More information about the MailScanner mailing list