Use Spamassassin learn function for all users

Hello,

I guess for recent setups you should check this one: http://help.directadmin.com/item.php?id=358 for maildir.

And yes, to make for all existing accounts I guess you need a script to list all of your users and their emails and execute the step 1 for every email account on your server.

A list of all domains with owners can be found here: /etc/virtual/domainowners, so you need a script that will go through that list and this one /etc/virtual/<domain>/passwd for every user/domain.
 
Thank you for your reply, now I need to find someone that can actually write a script for it.

Can you or do you know someone that can do it for free or a good price?

Thank you.
 
Here is a script to set folders and subsciptions:

Code:
#!/bin/bash
##
## written by Alex $ 2014-06-09 (http://plugins-da.net/)
###########################################################################
## Linux Administrator at your service
## Server Management | Server Migration | Server Support | Server Setup
## Writing custom Plugins for Directadmin.
###########################################################################
##
## The script creates imap folders for all email accounts on the server
## according to this guide http://help.directadmin.com/item.php?id=358
##


for domain in `cat /etc/virtual/domains`;
do
    username=`grep ^$domain: /etc/virtual/domainowners | cut -d\  -f2`
    echo "[+] Working with $domain owned by $username";
    for data in `cat /etc/virtual/$domain/passwd`;
    do
        ebox=`echo $data | cut -d\: -f1`;
        maildir="`echo $data | cut -d\: -f6`/Maildir";
        echo "[+][+] Working with $ebox@$domain with Maildir in $maildir";


        [ -d "$maildir/.INBOX.teach-isspam" ] || mkdir -v $maildir/.INBOX.teach-isspam
        [ -d "$maildir/.INBOX.teach-isnotspam" ] || mkdir -v $maildir/.INBOX.teach-isnotspam


        chown -vR $username:mail $maildir/.INBOX.teach-*
        chmod -v 770 $maildir/.INBOX.teach-*


        c=`grep INBOX.teach-isspam $maildir/subscriptions -c`
        if [ $c -eq 0 ]; then
            echo INBOX.teach-isspam >> $maildir/subscriptions
        fi;


        c=`grep INBOX.teach-isnotspam $maildir/subscriptions -c`
        if [ $c -eq 0 ]; then
            echo INBOX.teach-isnotspam >> $maildir/subscriptions
        fi;
    done;
done;


exit 0;


That's up to you set up cron.
 
Last edited:
Back
Top