Child pages
  • UAPI Functions - Email::get_spam_settings
Skip to end of metadata
Go to start of metadata

Description

This function retrieves the Apache SpamAssassin™ settings for the account.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Email/get_spam_settings?account=username%40example.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// List Apache SpamAssassin settings.
$sa_settings = $cpanel->uapi(
    'Email', 'get_spam_settings',
    array(
        'account' => 'username@example.com',
         )
);

Unable to render {include} The included page could not be found.

 

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.

# List Apache SpamAssassin settings.
my $sa_settings = $cpliveapi->uapi(
    'Email', 'get_spam_settings',
    {
        'account' => 'username@example.com'
    }
);

Unable to render {include} The included page could not be found.

 

 cPanel Template Toolkit
<!-- List Apache SpamAssassin settings. -->
[% execute('Email', 'get_spam_settings', { 'account' => 'username@example.com' }) %]


Note:

For more information, read our Guide to Template Toolkit documentation. 

 

 Command Line
uapi --user=username Email get_spam_settings account=username%40example.com


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{
  "result" : {
     "data" : {
        "spam_as_acl" : 1,
        "spam_auto_delete_score" : "8",
        "spam_enabled" : 1,
        "spam_auto_delete" : 0,
        "spam_status_changeable" : 1,
        "cpuser_spam_auto_delete" : 1,
        "rewrites_subjects" : 1,
        "cpuser_spam_auto_delete_score" : 8,
        "spam_box_enabled" : 0
     },
     "status" : 1,
     "messages" : null,
     "errors" : null
  }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
accountstring

Retrieve a specific user account's SpamAssassin settings.

Note:

We added this parameter in cPanel & WHM version 70.

If you do not specify this parameter, the function returns the settings for the default account.

A valid user email account.username@example.com

Returns

ReturnTypeDescriptionPossible valuesExample
spam_enabledBoolean

Whether the server's global spam filtering is enabled.

Note:

This value will only return 0 if the cPanel user disables Apache SpamAssassin.

  • 1 — Enabled.
  • 0 — Not enabled.
1
rewrites_subjectsBooleanWhether the user's spam filter rewrites the subject lines of spam messages.
  • 1 — Rewrite.
  • 0 — No rewrites.
1
spam_status_changeableBoolean

Whether the server allows cPanel users to configure Apache SpamAssassin settings.

  • 1 — Allowed.
  • 0 — Not allowed.
1
spam_as_aclBooleanWhether the user's spam filter uses Apache SpamAssassin as an ACL.
  • 1 — SpamAssassin is an ACL.
  • 0 — SpamAssassin is not an ACL.
1
spam_auto_deleteBooleanWhether the user's autodelete function is enabled.
  • 1 — Enabled.
  • 0 — Not enabled.
0
spam_box_enabledBooleanWhether the user's spam box is enabled.
  • 1 — Enabled.
  • 0 — Not enabled.
0
spam_auto_delete_scorestring

Displays the user's spam filter threshold.

Note:

For more information, read our UAPI Email::add_spam_filter documentation.

  • The spam filter threshold value.
  • null

8

cpuser_spam_auto_deleteBoolean

Whether the cPanel user enabled an account-wide spam filter.

Note:

We introduced this return in cPanel & WHM version 70.

  • 1 — Enabled.
  • 0 — Not enabled.
1
cpuser_spam_auto_delete_scoreinteger

The cPanel user's account-wide spam filter threshold score.

Note:

We introduced this return in cPanel & WHM version 70.

  • The spam filter score value.
  • null
8