• 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!
  • 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.

Changing anti-spam and anti-virus for all accounts at once in SSH?

HHawk

Regular Pleskian
I did a search and came up with the following posted by IgorG and I quote:

For mass enabling antispam or antivirus for all emails you can use following scripts:

# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/spamassassin -u $i -status true; done

# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select concat(mail.mail_name,\"@\",domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address"`; do /usr/local/psa/bin/mail -u $i -antivirus inout; done

First; this still works with Plesk 12.5 as well, right?

And how would I enable anti-spam (using the above) and set all emailaccounts to "Move spam to the Spam folder" (move)? I don't dare to fool around myself before I mess up things to be honest.

Also I want the anti-virus to be set to scan only incoming email (in) for all emailaccounts.

Thanks in advance for your help and advice.

Regards
 
Hello HHawk,

Regarding your question about enable anti-spam and "Move spam to the Spam folder" for all the e-mail accounts, the solution is:

mysql -uadmin -p`cat /etc/psa/.psa.shadow ` -Dpsa -Ne"SELECT CONCAT(mail_name,'@',name) FROM mail,domains WHERE dom_id=domains.id AND postbox='true';"|while read i;do /usr/local/psa/bin/spamassassin -u $i -status true -action move -hits 6;done

Best regards,
Horacio Stolovitzky
 
Wow thanks HoracioS!

One final question though. With the SSH command you gave me, how do I add (as an example) the following emailaddresses to the white-list: *@firstdomain.com and *@seconddomain.com?

Would it be this:

mysql -uadmin -p`cat /etc/psa/.psa.shadow ` -Dpsa -Ne"SELECT CONCAT(mail_name,'@',name) FROM mail,domains WHERE dom_id=domains.id AND postbox='true';"|while read i;do /usr/local/psa/bin/spamassassin -u $i -status true -action move -hits 6 -whitelist add:*@firstdomain.com,*@seconddomain.com;done

Or is that incorrect?

Or is adding these emailaddresses under "Tools & Settings" >> "Spam Filter" >> "White List" be enough? And therefor making it unnecessary to do it with the SSH command as shown above (in other words override it)?

Thanks once again in advace for your time and answer!
 
Much of that you do with utilities from /usr/local/psa/bin/ directory have the same effect when you do it from Plesk interface.
In you sample it doesn't matter how you will add emails to whitelist - through the command line command or GUI.
 
So if I add the emailaddresses to the "Tools & Settings" >> "Spam Filter" >> "White List" it will apply anyways for all hostingaccounts and therefor emailaccounts server-wide?
Awesome. :)
 
Back
Top