Add to Favourites Add to Favourites    Print this Article Print this Article

How to enable SpamAssassin for new accounts

By default (if enabled), DA gives the User the option to enable spamassassin, but it is not turned on by default.

To have it on by default, you can use the script to create it for you.


in it, add:

if [ "$spam" = "ON" ]; then
  mkdir -p $DIR
  if [ ! -s ${UP} ]; then
     echo 'required_score 5.0' > ${UP}
     echo 'report_safe 1' >> ${UP}
     chown $username:$username  ${UP}
     chmod 644 ${UP}
  chown  ${username}:mail $DIR
  chmod 771 $DIR

  if [ "${domain}" != "" ]; then
     if [ ! -s ${FCONF} ]; then
        echo 'high_score=15' > ${FCONF}
        echo 'high_score_block=no' >> ${FCONF}
        echo 'where=inbox' >> ${FCONF}
        chown mail:mail ${FCONF}

        echo "action=rewrite&value=filter&user=$username" >> /usr/local/directadmin/data/task.queue
exit 0;

Once created, save it and chmod the to 755.

The above script can be used to also enable spamassassin for all existing accounts.  You can create another  simple script to do it called (for example) with the following code:

for i in `ls /usr/local/directadmin/data/users`; do
         for d in `cat /usr/local/directadmin/data/users/$i/domains.list`; do
                     username=$i domain=$d spam=ON /usr/local/directadmin/scripts/custom/
exit 0;

save this new script, chmod it to 755, and run it once.

Was this answer helpful?

Also Read