listCreate()

Create new list..

listCreate(string $title, array $options) : string
Input parametrs
  • title - list name
  • options - array of campaign parameters consisting of:
    • permission_reminder - reminder message for users how they got on this list
    • notify_to - email address where notificiations will be sent
    • subscription_notify - whether notification is sent that a new user has been subscribed (true, false)
    • unsubscription_notify - whether notification is sent that a new user has been unsubscribed (true, false)
    • has_email_type_option - whether user can pick email format (true, false)
Information obtained

Array of lists. Each list is represented as an array that includes:

  • ID of the new list

Examples

mgapi_listCreate.php
 'Write a short reminder about how the recipient joined your list.',
    'notify_to' => 'example@example.org',
    'subscription_notify' => true,
    'unsubscription_notify' => true,
    'has_email_type_option' => true
);
 
$retval = $api->listCreate($title, $options);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load listCreate()!\n";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "New List ID:" . $retval . "\n";
}
xml-rpc_listCreate.php
 new xmlrpcval($apikey),
                    'title' => new xmlrpcval('Test List'),
                    'options' => php_xmlrpc_encode(
                            array(
                                "permission_reminder" => 'Write a short reminder about how the recipient joined your list.',
                                "notify_to" => 'example@example.org',
                                "subscription_notify" => true,
                                "unsubscription_notify" => true,
                                "has_email_type_option" => true
                            )
                    )
                ),
                'struct');
$f = new xmlrpcmsg('listCreate', 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 "Returned: " . $retval . "\n";
} else {
    echo "Unable to load listCreate()!\n";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
}

© 2010-2017 Mailigen. All rights reserved.