PHP code example of dotit / sarbacane-bundle

1. Go to this page and download the library: Download dotit/sarbacane-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dotit / sarbacane-bundle example snippets


/**** Create email new campaign *******/


$campaign = new Campaign();
$campaign->name='New Campaign';
$campaign->aliasFrom='Sender';
$campaign->subject='Object';
$campaign->emailFrom='[email protected]';
$campaign->aliasReplyTo='sender';
$campaign->emailReplyTo='[email protected]';
$campaignID = CampaignManager::createCampaign($campaign);

/******ADD RECIPIENTS TO A CAMPAIGN*****/
$recipients =array(
            array('email' => '[email protected]','phone' => '216xxxxxxxx'),
            array('email' => '[email protected]','phone' => '2162xxxxxxx')
        );
CampaignManager::campaignSetRecipients($campaignID,$recipients);

/******* SEND CAMPAIGN ********************/
CampaignManager::sendCampaign($campaignID);

/***** GET CAMPAIGNS *********************/

//$ limit and offset can be null 
$campaigns = CampaignManager::getCampaigns($limit, $offset);

/********* SET A LIST TO CAMPAIGN ********/

CampaignManager::campaignSetList($campaignID,$listID);

/********* SET A MODEL TO CAMPAIGN ********/

CampaignManager::campaignSetModel($campagnID,$modelID);

/*****  CREATE NEW LIST ********/

$listID = ListManager::createList($name);

/****** ADD CONTACTS TO LIST *******/
$contacts= array(
            array('email' => '[email protected]','phone' => '216xxxxxxxx'),
            array('email' => '[email protected]','phone' => '2162xxxxxxx')
        );
ListManager::addContacts($listID,$contacts);

/****** GET LIST ******************/

//$ limit and offset can be null 
$lists = ListManager::getList($limit,$offset);