• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Default Spam and Antivirus settings for new Mailboxes

TorbHo

Basic Pleskian
Is there a way to set the default settings for Antivirus and Spam for newly created mailboxes for all users?

I would like to activate Antivirus and move to Spam dir by default. Many of our users don't know that the have to activate filtering of spam and are therefore complaining about too much Spam.
 
No reaction yet. So, I think there is no such option?
Not even with cli or modifying the database?
 
As far as I know there is no such option unfortunately. You could however use the CLI to achieve this.

Create a bash script and add the lines below and setup a "Mail account created" event in the Event Manager to call your script.

Bash:
#enable antivirus for both in and out going mail
/usr/local/psa/bin/mail --update ${NEW_MAILNAME} -antivirus inout

#enable spam filter
/usr/local/psa/bin/spamassassin --update ${NEW_MAILNAME} -status true

#set spamfilter to move spam message to spam folder
/usr/local/psa/bin/spamassassin --update ${NEW_MAILNAME} -action move

(I haven't tested this code myself. I highly recommended you test this first for yourself.)
 
Last edited:
What @Rasp say is correct, I use it for all my servers

You can also set the default spam score:

plesk bin spamassassin -u ${NEW_MAILNAME} -hits 7
If the message has a spam score more than 7 will be falgged as SPAM. You can choose the number you prefer.
I use to write "plesk bin" instead of "/usr/local/psa/bin/" but it's the same thing.

If you want to change the settings for all email account previusly created you can use while:

plesk bin mail -l | grep "Mail name"| awk '{print $3}' | while read file; do plesk bin spamassassin -u $file -action move; done

plesk bin mail -l > list all email on your server
grep "Mail name" > include only Mailbox (avoid to include alias)
awk '{print $3}' > print only the mail
while ... ... > for each email do the command you prefer
 
You can also enable DKIM when a new subscription is added, which I believe Plesk doesn't do by default:

Code:
plesk bin subscription_settings -u example.com -sign_outgoing_mail true
 
You have to change it manually, but you can do this with those commands:

Code:
plesk bin mail -l | grep "Mail name"| awk '{print $3}' | while read file; do plesk bin spamassassin -u $file -action move; done
plesk bin mail -l | grep "Mail name"| awk '{print $3}' | while read file; do plesk bin spamassassin -u $file -hits 7; done
plesk bin mail -l | grep "Mail name"| awk '{print $3}' | while read file; do plesk bin spamassassin -u $file -status true; done
 
Back
Top