How to enable SpamAssassin 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 for new accountsLast Modified: Nov 30, 2009, 4:31 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 user_create_post.sh script to create it for you.

Create:
/usr/local/directadmin/scripts/custom/user_create_post.sh

in it, add:

#!/bin/sh
if [ "$spam" = "ON" ]; then
   DIR=/home/$username/.spamassassin
   mkdir  $DIR
   touch $DIR/user_prefs             #or this is where you'd copy  the default user_prefs you want them to have, instead of "touch".
   chown  ${username}:mail $DIR
   chmod 771 $DIR
   chown $username:$username  $DIR/user_prefs
   chmod 755 $DIR/user_prefs
   touch $DIR/spam
   chown  mail:$username $DIR/spam
   chmod 660 $DIR/spam
fi
exit 0;

Once created, save it and chmod the user_create_post.sh 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) spam.sh with the following code:

#!/bin/sh
for i in `ls /usr/local/directadmin/data/users`; do
{
  username=$i spam=ON /usr/local/directadmin/scripts/custom/user_create_post.sh
};
done;
exit 0;

save this new spam.sh 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

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