Hello Friends,
You can enable the spamassasin for single account or all accounts using this information.. To enable SpamAssassin , you have to add as file named ".spamassassinenable" to /home/user and then add the folder .spamassassin to /home/user with a user_prefs file in it.. To further test it, you can enable it for one account to see the file contents for the /home/user/.spamassassin/user_prefs file.
You can then copy this file to /root/spamassassin/user_prefs and then create a postwwwacct script to have it enabled by default when the user account is created:
Note: The username should be replaced accordingly.
Create a file postwwwacct at location /usr/local/cpanel/scripts/ and add the below code in it:
Code:
After creating this file, just make sure that it has executable permission:
Enable it for all users using below one-liner bash scripts:
You can enable the spamassasin for single account or all accounts using this information.. To enable SpamAssassin , you have to add as file named ".spamassassinenable" to /home/user and then add the folder .spamassassin to /home/user with a user_prefs file in it.. To further test it, you can enable it for one account to see the file contents for the /home/user/.spamassassin/user_prefs file.
You can then copy this file to /root/spamassassin/user_prefs and then create a postwwwacct script to have it enabled by default when the user account is created:
mkdir /root/spamassassin
cp /home/user/.spamassassin/user_prefs /root/spamassassin
cp /home/user/.spamassassin/user_prefs /root/spamassassin
Create a file postwwwacct at location /usr/local/cpanel/scripts/ and add the below code in it:
Code:
Code:
#!/usr/bin/perl my %OPTS = @ARGV; $ENV{USER} = “$OPTS{‘user’}â€; system q(mkdir /home/$USER/.spamassassin); system q(touch /home/$USER/.spamassassinenable); system q(cp /root/spamassassin/user_prefs /home/$USER/.spamassassin/); system q(chown $USER:$USER /home/$USER/.spamassassinenable); system q(chown -R $USER:$USER /home/$USER/.spamassassin); system q(chmod 700 /home/$USER/.spamassassin);
After creating this file, just make sure that it has executable permission:
chmod +x /usr/local/cpanel/scripts/postwwwacct
for i in `cat /etc/trueuserdomains | awk {'print $2'}` ;do mkdir /home/$i/.spamassassin && touch /home/$i/.spamassassinenable ;done
for i in `cat /etc/trueuserdomains | awk {'print $2'}` ;do cp /root/spamassassin/user_prefs /home/$i/.spamassassin/ ;done
for i in `cat /etc/trueuserdomains | awk {'print $2'}` ;do chown $i:$i /home/$i/.spamassassinenable && chown -R $i:$i /home/$i/.spamassassin ;done
for i in `cat /etc/trueuserdomains | awk {'print $2'}` ;do cp /root/spamassassin/user_prefs /home/$i/.spamassassin/ ;done
for i in `cat /etc/trueuserdomains | awk {'print $2'}` ;do chown $i:$i /home/$i/.spamassassinenable && chown -R $i:$i /home/$i/.spamassassin ;done