Child pages
  • UAPI Functions - SpamAssassin::clear_spam_box
Skip to end of metadata
Go to start of metadata

Description

This function clears the spam box of all its contents for all email accounts.

Important:

This function deletes the Spam Box folder contents for every email address on the account, which includes the default account.


Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/SpamAssassin/clear_spam_box


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.

// Clear the spam box for all email accounts.
$sa_settings = $cpanel->uapi(
    'SpamAssassin', 'clear_spam_box'
);


Note:

For more information, read our Guide to the LiveAPI System.

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

# Clear the spam box for all email accounts.
my $sa_settings = $cpliveapi->uapi(
    'SpamAssassin', 'clear_spam_box'
);


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Clear the spam box for all email accounts. -->
[% execute('SpamAssassin', 'clear_spam_box' ) %]
[% END %]


Note:

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

 Command Line
uapi --user=username SpamAssassin clear_spam_box


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. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
    "apiversion": 3,
    "module": "SpamAssassin",
    "func": "clear_spam_box",
    "result": {
        "data": null,
        "status": 1,
        "warnings": null,
        "errors": null,
        "metadata": {},
        "messages": [
            "Clearing Spam Box for main account. ... Done",
            "Clearing Spam Box for “user@example.com”. ... Done"
        ]
    }
}


Note:

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

Parameters

This function does not accept any parameters.

Returns

This function only returns metadata.