campaignSendTest()

Submit request of delivering test mails of campaign which previously was saved as a draft.

campaignSendTest(string $cid, array $test_emails, string $send_type) : boolean
Input parameters
  • cid - campaign ID
  • test_emails - list of test emails (array)
  • send_type - sending type (HTML, plain) (optional)
Information obtained
  • true, if request of test mail delivery has succeeded. Otherwise, an error message is returned.

Examples

mgapi_campaignSendTest.php
campaignSendTest($cid, $test_emails);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load campaignSendTest()!\n";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "Campaign Tests Sent!\n";
}
xml-rpc_campaignSendTest.php
 new xmlrpcval($apikey),
                    'cid' => new xmlrpcval($campaignId),
                    'test_emails' => php_xmlrpc_encode(
                        array($my_email, $boss_man_email)
                    )
                ),
                'struct');
$f = new xmlrpcmsg('campaignSendTest', array($v));
$c = new xmlrpc_client($apiUrl["path"], $apiUrl['host'], 80);
$c->setDebug($debug);
$r = &$c->send($f);
 
header("Content-Type: text/plain");
if (!$r->faultCode()) {
    $retval = php_xmlrpc_decode($r->value());
    echo "Campaign Tests Sent!\n";
} else {
    echo "Unable to run campaignSendTest()!\n";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
}
mgapi_campaignSendTest.py
from lib.config import * #contains apikey
from lib.MGAPI import MGAPI
 
# This Example shows how to ping using the MGAPI.php class and do some basic error checking.
 
api = MGAPI(apikey)
 
cid = campaignId
test_emails = [my_email, boss_man_email]
 
retval = api.campaignSendTest(cid, test_emails)
if api.errorCode:
    print "Unable to load campaignSendTest()!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
else:
    print "Campaign Tests Sent!"

© 2010-2017 Mailigen. All rights reserved.