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

Description

This function returns the first 200 lines of an email in the BoxTrapper queue.

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/get_message?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.

// Retrieve a specific email from user@example.com.
$get_message = $cpanel->uapi(
    'BoxTrapper', 'get_message',
    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.
 
# Retrieve a specific email from user@example.com.
my $get_message = $cpliveapi->uapi(
    'BoxTrapper', 'get_message',
    {
        'email'     => 'user@example.com',
		'queuefile' => 'example.msg',
    }
);


Note:

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

 Command Line
uapi --user=username BoxTrapper get_message 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":{  
        "queuefile" : "rhzaBZzNQCaZ02EFqYblT-1557235836.msg",
        "contents" : "From user@example.com Tue May 07 08:30:36 2019\nReceived: from user by example.com with local (Exim 4.92)\n\t(envelope-from <root@yourserver.net>)\n\tid 1hO0B1-0003Ev-Md\n\tfor user2@example.com; Tue, 07 May 2019 08:30:36 -0500\nFrom: someone@outherwhere.com\nSubject: Go!!!\nMessage-Id: <E1hO0B1-0003Ev-u3er2@example.com>\nDate: Tue, 07 May 2019 08:30:35 -0500\n\nGo!!!\n\n"
   },
   "status":1,
   "warnings":null,
   "errors":null,
   "messages":null,
   "metadata":{  

   }
}


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 account's email address.

Important:

If you call this function in Webmail, the system ignores this parameter.

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

Required

The message's filename.

A valid filename.example.msg

Returns

ReturnTypeDescriptionPossible valuesExample
queuefilestring

The message's filename.

A valid filename.example.msg
content

string

The email message's contents.

Up to the first 200 lines of an email message.

From user@example.com Tue May 07 08:30:36 2019
Received: from user by example.com with local (Exim 4.92)
(envelope-from <root@yourserver.net>)\n\tid 1hO0B1-0003Ev-Md
for user2@example.com; Tue, 07 May 2019 08:30:36 -0500
From: user3@example.com
Subject: Message
Message-Id: <E1hO0B1-0003Ev-Md@yourserver.net>
Date: Tue, 07 May 2019 08:30:35 -0500

This is an email message