Article ID: 122368, created on Jul 15, 2014, last review on Mar 27, 2015

  • Applies to:
  • Plesk Automation 11.5

Symptoms

How to enable Spamassassin by default on mail accounts? I want that Spamassassin is enabled when I create new mail account.

Resolution

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
    /root/mail.sh $NEW_MAILNAME
    
  3. On Management Node create a script:

    [root@ppa ~]# cat /root/mail.sh
    sleep 30
    /usr/local/psa/bin/spamassassin -u $1 -status true
    

    Additional parameters for 'spamassasin' command are:

    -action            <del|mark|move> what to do with spam mail
    -modify-subj       <true|false>    modify spam mail subject
    -modify-subj-text  <string>        modify spam mail subject text
    
  4. Make it executable:

    [root@ppa ~]# chmod +x /root/mail.sh
    

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

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

#!/bin/sh

#Get the list of mailboxes registered in PPA

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

    #Enable spamassassin for mailboxes

    while read mailbox
    do
    /usr/local/psa/bin/spamassassin -u $mailbox -status true
    done < /tmp/mailboxes_list

Search Words

mail_spam_restore... not exists

spamassassin mail forward

Turn on spamassasin automatically during new e-mail account creation

enforce inbound blacklists but not on smtp authentication

33a70544d00d562bbc5b17762c4ed2b3 e0aff7830fa22f92062ee4db78133079 caea8340e2d186a540518d08602aa065

Email subscription for changes to this article
Save as PDF