• 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

Spam and Kaspersky

yurka

New Pleskian
Hi,

How can I enable Spam and Kaspersky filtering on all mailboxes in server at once (it if possible). Without need to do it one by one.

10x
 
You can use following sql query for extracting all email addresses from psa database:

select concat(mail.mail_name,"@",domains.name) as name from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id;

and use it for script for updating mailsettings like (for antivir):

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

or for Spam:

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

But problem in that for some reasons sql query works fine inside mysql environment:

mysql> select concat(mail.mail_name,"@",domains.name) as name from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id;
+--------------------------------+
| name |
+--------------------------------+
| [email protected] |
| [email protected] |
+--------------------------------+
2 rows in set (0.00 sec)

But doesn't work in shell:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "select concat(mail.mail_name,"@",domains.name) as name from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id"
NULL
NULL

Try to catch up why and you will get good solution :)
 
Well. Problem was in "@"
There should be '@' in sql query :)
 
10x, will tryit.

Is it possible to enable spam and to enable the "Move to SPAM folder" as well?

P.S.
For some reason enabling "Move to SPAM folder" from Plesk Panel do nothig, the mails still coming to Inbox with ****Spam**** in subject.
 
Last edited:
for moving spam to folder just change
-status=true
to
-status true -action move -modify-subj true
 
Right. Just use necessary options for corresponding CLI utilities.
 
Even when move to spam folder option is selected still all spam marked mail come to Inbox. Any suggestions?
10x
 
Yes. in subject I see ******Spam*****
I upgraded the system from 8.6 to 10..2, may be there some permission problems ?
 
Back
Top