Move all mails from all accounts to spam folder if some header is found

Augusto Will

Active Member
Sep 9, 2011
43
6
58
cPanel Access Level
Root Administrator
I need to move all e-mail with some header to spam forder of account. Example:

user [email protected] -> have some header -> move to spam folder of [email protected]
user [email protected] -> have some header -> move to spam folder of [email protected]

Is possible to do that in anyway or use global filter of e-mails /etc/vfilter/domain.com and mode email from user account?

Because one of domain has this code in /etc/vfilter this content:

if
$header_subject: contains "{vpara}"
then
deliver "\"domain+spam\""
endif


The problem of that is all mail that subject contains {vpara} is moved to spam folder of default account, not the account that received that e-mail.
Is possible to use some variable to move the e-mail to the account that received that e-mail?
Or do that with any other way?

Thanks.
 
  • Like
Reactions: Gino Viroli

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,202
363
I need to do globally, not per e-mail account.
If possible with all e-mail in any e-mail account of the domain or better, any e-mail account in the server.
Hello,

There's no simple filter rule available for what you are seeking. Generally, this is setup by adding a custom SpamAssassin rule that detects messages as SPAM based on the content you specific. SpamAssassin documents how to write custom rules at:

WritingRules - Spamassassin Wiki

However, you may need to consult with a system administrator if you need help writing custom rules:

System Administration Services | cPanel Forums

Thank you.