Article ID: 125047, created on Mar 29, 2015, last review on Mar 29, 2015

  • Applies to:
  • Plesk Automation 11.5


How to enable antivirus checking on a newly created mailbox by default?


Create Plesk event handler:

  1. Go to PPA with link: https://<ppa_ip_address>:8443/plesk/server/event-handlers/

  2. Create mail handler like below:

    Mail account created
    lowest (0)
    /root/ $NEW_MAILNAME
  3. On Management Node create a script:

    [root@ppa ~]# cat /root/
    sleep 30
    /usr/local/psa/bin/mail -u $1  -antivirus inout

    Additional options for 'mail -antivirus' command are:

     -antivirus   <off|inout|in|out>    manages antivirus filtering for mail
                                        traffic. "Off" disables antivirus
                                    filtering, "Inout" enables it for mail
                                    traffic going in any direction, "In"
                                    enables it for incoming mail only, and
                                    "Out" for outgoing mail only.
  4. Make it executable:

    [root@ppa ~]# chmod +x /root/

    Now when you create new mail account, antivirus will be enabled by default in mail account.

In order to enable antivirus for all existing mailboxes you can use the following script:


#Get the list of mailboxes registered in PPA

    mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -sNe "select mail.mail_name, from mail left join domains on" | sed -E 's/[[:space:]]+/@/g' > /tmp/mailboxes_list

    #Enable antivirus for mailboxes

    while read mailbox
    /usr/local/psa/bin/mail -u $mailbox  -antivirus inout
    done < /tmp/mailboxes_list

33a70544d00d562bbc5b17762c4ed2b3 caea8340e2d186a540518d08602aa065 e0aff7830fa22f92062ee4db78133079

Email subscription for changes to this article
Save as PDF