Child pages
  • UAPI Functions - BoxTrapper::blacklist_messages
Skip to end of metadata
Go to start of metadata

Description

This function blacklists email message senders.

Important:

When you disable the MailReceive role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/BoxTrapper/blacklist_messages?email=user@example.com&queuefile=example.msg


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.
// blacklist the messages in the BoxTrapper queue.
$blacklist_messages = $cpanel->uapi(
    'BoxTrapper', 'blacklist_messages',
    array(
        'email'     => 'user@example.com',
        'queuefile' => 'example.msg',
    )
);


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.
 
# blacklist the messages in the BoxTrapper queue.
my $blacklist_messages = $cpliveapi->uapi(
    'BoxTrapper', 'blacklist_messages',
    {
        'email'     => 'user@example.com',
        'queuefile' => 'example.msg',
    }
);


Note:

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

 Command Line
uapi --user=username BoxTrapper blacklist_messages email=user@example.com queuefile=example.msg


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)
	{
      "data": [
         {

            "email" : "user@example.com",
            "operator" : "blacklist",
			"matches" : [
				"example.msg"
				]
         }
      ],
      "errors": null,
      "messages": null,
      "metadata": {
         "transformed": 1
      },
      "status": 1,
      "warnings": null
   }


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
email

string

Required

The email address for which to blacklist messages.

Warning

If you call this function in Webmail, the system ignores this parameter and defaults to the currently-authenticated user.

A valid email address on the cPanel account.user@example.com
queuefilestring

Required

The filename of the email message to blacklist.

To blacklist multiple email messages, pass this parameter multiple times.

A valid filename.

example.msg

Returns

ReturnTypeDescriptionPossible valuesExample

array of hashesAn array of hashes of blacklisted email information.This array of hashes contains the email, operator, matches, failed, warning, and reason returns.

email

string

The email address that sent the blacklisted message.

The function returns this value in the unnamed array of hashes.

A valid email address.user@example.com

operator

string

The action that the function performed.

The function returns this value in the unnamed array of hashes.

blacklist is the only possible value.blacklist

matches

array of stringsAn array of messages that the system deleted.

The function returns this value in the unnamed array of hashes.

An array of blacklisted email messagesexample.msg

failed

Boolean

Whether the system failed to blacklist the message.

Note:

The function only returns this value if it doesn't blacklist the message.

The function returns this value in the unnamed array of hashes.

1 is the only possible value.1

warning

Boolean
Whether the system experienced issues when it blacklisted the message.

Note:

The function only returns this value if it doesn't blacklist the message.

The function returns this value in the unnamed array of hashes.

1 is the only possible value.1

reason

string
A message about the failure or the warning.

Note:

The function only returns this value if it doesn't delete the message or experiences issues when it deletes the message.

The function returns this value in the unnamed array of hashes.

A valid string.This is a failure message.