Determine which users have spamassassin enabled

PeteS

Well-Known Member
Jun 8, 2017
390
88
78
Oregon
cPanel Access Level
Root Administrator
I'd like to check which users have Process New Emails and Mark them as Spam: enabled (server-wide).

Secondly I'd like to be able to turn it on (using server default values) without using the global force on in Exim config (so users can disable if they want). (I know new accounts now enable it by defaults, but for accounts the predate that I want to enable it without removing users' ability to disable.)
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,309
363
Houston

PeteS

Well-Known Member
Jun 8, 2017
390
88
78
Oregon
cPanel Access Level
Root Administrator
Hi @PeteS

The following two UAPI commands will do what you're requesting:

UAPI Functions - Email::enable_spam_assassin - Developer Documentation - cPanel Documentation
UAPI Functions - Email::get_spam_settings - Developer Documentation - cPanel Documentation

These are per account API functions so if you need to run this for multiple accounts you'll need to write a custom script to obtain that data.

Thanks!
Thank you. (APIs, of course, I should have thought of that.)

I'll have to work on a script to implement this.

-Pete
 

PeteS

Well-Known Member
Jun 8, 2017
390
88
78
Oregon
cPanel Access Level
Root Administrator
In the end, I have decided to deal with past accounts as necessary, one at a time, since the new accounts enable it by default (spam threshold 5, no delete).

I did find this which may help someone as well (NOT tested...UAYOR).
knownhost.com/wiki/control-panels/cpanel-whm/how-can-i-enable-spamassassin-on-all-cpanel-accounts

-Pete
 
Last edited by a moderator:
  • Like
Reactions: cPanelLauren

marcochiesi

Active Member
Mar 1, 2011
25
1
53
Italy
cPanel Access Level
Root Administrator
Twitter
For anyone interested here's a one-liner command to detect all the accounts having SpamAssassin's "Move New Spam to a Separate Folder (Spam Box)" option not enabled:
Bash:
for i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ; do if [ ! -f "/home/$i/.spamassassinboxenable" ]; then echo $i: Not enabled; fi; done
 
  • Like
Reactions: cPanelLauren