CampaignMonitor::createCampaign PHP Метод

createCampaign() публичный Метод

Creates a campaign. Returns the campaign ID when succesful or false if the call failed
public createCampaign ( string $name, string $subject, string $fromName, string $fromEmail, string $replyToEmail, string $HTMLContentURL, string $textContentURL, array $subscriberLists, array $subscriberListSegments = [], string[optional] $clientId = null ) : string
$name string The name of the new campaign. This must be unique across all draft campaigns for the client.
$subject string The subject of the new campaign.
$fromName string The name to appear in the From field in the recipients email client when they receive the new campaign.
$fromEmail string The email address that the new campaign will come from.
$replyToEmail string The email address that any replies to the new campaign will be sent to.
$HTMLContentURL string The URL of the HTML content for the new campaign.
$textContentURL string The URL of the text content for the new campaign.
$subscriberLists array An array of lists to send the campaign to.
$subscriberListSegments array An array of Segment Names and their appropriate List ID’s to send the campaign to.
$clientId string[optional]
Результат string
    public function createCampaign($name, $subject, $fromName, $fromEmail, $replyToEmail, $HTMLContentURL, $textContentURL, array $subscriberLists, $subscriberListSegments = array(), $clientId = null)
    {
        // set client ID
        $clientId = empty($clientId) ? $this->getClientId() : $clientId;
        // set parameters
        $parameters['Name'] = (string) $name;
        $parameters['Subject'] = (string) $subject;
        $parameters['FromName'] = (string) $fromName;
        $parameters['FromEmail'] = (string) $fromEmail;
        $parameters['ReplyTo'] = (string) $replyToEmail;
        $parameters['HtmlUrl'] = (string) $HTMLContentURL;
        $parameters['TextUrl'] = (string) $textContentURL;
        $parameters['ListIDs'] = !empty($subscriberLists) ? $subscriberLists : array();
        $parameters['SegmentIDs'] = !empty($subscriberListSegments) ? $subscriberListSegments : array();
        // return the result
        return (string) $this->doCall('campaigns/' . $clientId, $parameters, 'POST');
    }