This is a helper function that allows you to quickly create and send a campaign.

If you need advanced functions like stats, pausing, resuming etc. consider using functions described inside Campaigns and Mailing Lists sections.

Note that this function shouldn't be used to send transactional emails because our API has a rate limit. In this case, you should use our SMTP server.


Name Type Description
apiKey string API key previously generated.
emails array Array with all recipients in the following format:

array( 'name' => 'Name 1', 'email' => '' ),
array( 'name' => 'Name 1', 'email' => '' )

Name is optional and email is required. If an invalid email is provided it will be automatically ignored.
subject string Subject of the message.
html string Html of the message. There is no need to provide plain text as it is automatically generated based on the provided html.
mailboxFromId integer Id of the mailbox that will be used on the From header. You can get all mailboxes using function.
mailboxReplyId integer Id of the mailbox that will be used on the Reply-To header. You can get all mailboxes using function.
mailboxReportId integer Mailbox report id. You can get all mailboxes using function.
packageId integer Id of the package used to send this email. You can get all packages using function.
attachments array Optional parameter in case you want to add attachments. Its elements should follow this structure:

array( ‘name’ => ‘Filename.jog’, ‘data’ => ‘DataEncodedInBase64’ )

The data parameter is the content of the file encoded with base64.


Returned data

Type: boolean

Description: Return true if emails were corrected placed on mailing list queue.


Json sample code


$curl = curl_init('https://your_address/ccm/admin/api/version/2/&type=json');

// Create rcpt array to send emails to 2 rcpts
$rcpt = array(
        'name' => 'My Optional Name 1', 
        'email' => ''
        'name' => null, 
        'email' => ''

$postData = array(
    'function' => 'sendMail',
    'apiKey' => 'apiKey',
    'subject' => 'Subject 1',
	'html' => '<html><head><title>Title</title></head><body><h1>My Email</h1></body></html>',
	'mailboxFromId' => 1,
	'mailboxReplyId' => 1,
	'mailboxReportId' => 1,
	'packageId' => 6,
	'emails' => $rcpt

$post = http_build_query($postData);

curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$json = curl_exec($curl);
if ($json === false) {
    die('Request failed with error: '. curl_error($curl));

$result = json_decode($json);
if ($result->status == 0) {
    die('Bad status returned. Error: '. $result->error);



Result of API call

Menu Title