[How to] Enable spam filter and antivirus for all mailboxes

Created:

2016-11-16 12:47:29 UTC

Modified:

2017-08-08 13:16:52 UTC

2

Was this article helpful?


Have more questions?

Submit a request

[How to] Enable spam filter and antivirus for all mailboxes

Applicable to:

  • Plesk 12.5 for Linux

Question

How to enable spam filter and antivirus on all mailboxes on a server and on a per-domain level?

Answer

Note : Before performing the below actions, create a backup of psa database:

# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow ` psa > /tmp/psadump.`date +%F_%H.%M`.sql

Use the following command to enable spam filter and antivirus on all mailboxes on a server:

    # mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa -NBe"select m.mail_name, d.name from mail as m left join domains as d on m.dom_id=d.id;" | while read j i; do /usr/local/psa/bin/mail -u $j"@"$i -antivirus inout; /usr/local/psa/bin/spamassassin -u $j@$i -status true ; echo "";done

Use the following command to enable spam filter and antivirus on all mailboxes for a certain domain (in this example domain is example.com):

    # mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa -NBe"select m.mail_name, d.name from mail as m left join domains as d on m.dom_id=d.id where name='example.com';" | while read j i; do /usr/local/psa/bin/mail -u $j"@"$i -antivirus inout; /usr/local/psa/bin/spamassassin -u $j@$i -status true ; echo "";done

This command takes mailbox names from the database and executes spamassasin and mail utilities to apply required settings to all mailboxes that were retrieved from the database.

Have more questions? Submit a request
Please sign in to leave a comment.