How to enable SpamAssassin/rspamd for new accounts

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » DirectAdmin
Top Level » Email » Spam

How to enable SpamAssassin/rspamd for new accountsLast Modified: Jun 22, 2019, 7:23 pm
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 grep -m1 -q '^spamd=rspamd$' /usr/local/directadmin/custombuild/options.conf; then
      echo "action=rewrite&value=rspamd&user=${username}" >> /usr/local/directadmin/data/task.queue

  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.
Related Helpfiles
How to enable SpamAssassin on your server.
I wish to change the default spam settings for new domains

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST