#!/usr/local/cpanel/3rdparty/bin/perl # cpanel - scripts/spamboxdisable Copyright 2022 cPanel, L.L.C. # All rights reserved. # copyright@cpanel.net http://cpanel.net # This code is subject to the cPanel license. Unauthorized copying is prohibited use strict; use Cpanel::SafeFile; use Cpanel::LoginDefs (); use Getopt::Std; my %options = (); getopts( 'fqh', \%options ); $| = 1; if ( defined( $options{'h'} ) ) { print <) { my ( $uid, $homedir ) = ( split( /:/, $_ ) )[ 2, 5 ]; next if ( int($uid) < Cpanel::LoginDefs::get_uid_min() ); if ( -d $homedir ) { push( @homedirs, $homedir ); } } Cpanel::SafeFile::safeclose( \*PASS, $passwdlock ); my $removed = 0; foreach my $homedir (@homedirs) { if ( -e $homedir . '/.spamassassinboxenable' ) { unless ( defined( $options{'q'} ) ) { print "Unlinking $homedir/.spamassassinboxenable\n"; } unlink( $homedir . '/.spamassassinboxenable' ); $removed = 1; } } unless ( defined( $options{'q'} ) ) { if ($removed) { print "Done\n"; } else { print "No accounts currently have their spam box enabled.\n"; } }