cPanel & WHM Version 114 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Enable Greylisting in WHM, but Disable per Default for the customer

Martin Mueller shared this idea 7 years ago
Open Discussion

We have several customers, they didnt now "greylisting" at all, and are wondering, why mails arrive after several hours our system.

Greylisting is a great tool for spamfighting, but if the customer didnt know about the functionality of greylisting, it drives him mad.

Please add a switch, to enable greylisting globally , but disable by default for the customer. Actual we can only enable it globally, or disable it globally. The customer that knows greylisting can enable it.

Replies (8)



Thank you for your input. We do have a simple script you can run to accomplish this.

  1. #!/usr/local/cpanel/3rdparty/bin/perl

    # cpanel - Copyright(c) 2015 cPanel, Inc.

    # All rights Reserved.


    # This code is subject to the cPanel license.

    # Unauthorized copying is prohibited.

    use strict;

    use warnings;

    use LWP::UserAgent ();

    use HTTP::Cookies ();

    use JSON ();

    my $accesshash;

    open my $accesshash_fh, '<', '/root/.accesshash'

    or die "Unable to open /root/.accesshash: $!";

    while (<$accesshash_fh>) {


    $accesshash .= $_;


    my $useragent = LWP::UserAgent->new(

    cookie_jar => HTTP::Cookies->new,

    ssl_opts => {

    verify_hostname => 0,

    SSL_verify_mode => 0x00



    $useragent->default_header( 'Authorization' => "WHM root:$accesshash" );

    my $listaccts = $useragent->get(



    my $content = eval { JSON::decode_json( $listaccts->decoded_content ) };

    my @usernames;

    foreach my $acct ( @{ $content->{'data'}{'acct'} } ) {

    push @usernames, $acct->{'user'};


    print "Disabling Greylisting for " . scalar @usernames . " accounts:";

    foreach my $acct (@usernames) {

    my $success = $useragent->get(











    print $success->decoded_content;




thanks for the script, but it does only deactivate greylisting for all existing accounts. For new accounts it is activated like before.

We can't run the script after each new account, because it overwrites the usersettings from the users, when they want greylisting enabled.

What we need is the possibility, that greylisting is disabled by default for the accounts, and that the users/customers can enable it, if they want it.


We have recently disabled greylisting on all our servers because of this issue alone. We need to be able to enable the greylisting feature but disable it for the cPanel accounts by default and allow them the ability to enable it if they wish. To many new customers getting angry about delay in receiving emails. I would rather a customer open a ticket asking of better ways to prevent spam rather than potentially loosing a customer because they think we cannot properly deliver their email.


Hello guys, I've been thru this too, but found out the amazing free tool Configserver Mail Manage ( which allows you to selectively switch on/off Greylisting in a per account level. For those who want to keep in the same server bot clients who like greylisting and the others who don't want it at all, is a better solution than having to log into each individual cpanel account to switch it off :-)

Hope you find it useful.

Best regards


From what I understand, after the above scripts are run, any new Main/Addon/Sub Domains created will be enabled by default. This can be a major issues. Clients start complaining if mail is not there within a few seconds as it is.

Having Greylisting disabled by default and letting clients opt-in is honestly a better solution. The script helped, but I can already foresee complaints...


I would like to give some suggestions.

The greylisting system should appear on the user panel.

Today the Greylist system in the user panel, it can only enable and disable.

The Greylist system must be controlled by the user, where he may have the decision to leave a restricted email / domain or release to be received.

The user should only have access to e-mails and domains that send e-mails to the user's registered domain; he should not have access to e-mails and domains that are not sent to the user's domain.


It should be enabled on WHM, but disabled per default in cPanel Account.

Or a switch in WHM where every admin can decide to enable/disable it in the cPanel Account per default.

So the customer has the choice to enable it, if he activly wants greylisting.


This feature is already implemented. Should be marked so.

Leave a Comment
Attach a file