public function createCampaign(
        $senderName,
        $senderEmail,
        $subject,
        $bodyOrTemplateId,
        $bookId,
        $name = '',
        $attachments = '',
        $type = '',
        $useTemplateId = false
    ) {
        if (empty($senderName) || empty($senderEmail) || empty($subject) || empty($bodyOrTemplateId) || empty($bookId)) {
            return $this->handleError('Not all data.');
        }

        if (!empty($attachments)) {
            $attachments = serialize($attachments);
        }

        if($useTemplateId) {
            $paramName = 'template_id';
            $paramValue = $bodyOrTemplateId;
        } else {
            $paramName = 'body';
            $paramValue = base64_encode($bodyOrTemplateId);
        }

        $data = array(
            'sender_name' => $senderName,
            'sender_email' => $senderEmail,
            'subject' => $subject,
            $paramName => $paramValue,
            'list_id' => $bookId,
            'name' => $name,
            'attachments' => $attachments,
            'type' => $type,
        );

        $requestResult = $this->sendRequest('campaigns', 'POST', $data);

        return $this->handleResult($requestResult);
    }
public function createCampaign(
        $senderName,
        $senderEmail,
        $subject,
        $bodyOrTemplateId,
        $bookId,
        $name = '',
        $attachments = '',
        $type = '',
        $useTemplateId = false
    ) {
        if (empty($senderName) || empty($senderEmail) || empty($subject) || empty($bodyOrTemplateId) || empty($bookId)) {
            return $this->handleError('Not all data.');
        }

        if (!empty($attachments)) {
            $attachments = serialize($attachments);
        }

        if($useTemplateId) {
            $paramName = 'template_id';
            $paramValue = $bodyOrTemplateId;
        } else {
            $paramName = 'body';
            $paramValue = base64_encode($bodyOrTemplateId);
        }

        $data = array(
            'sender_name' => $senderName,
            'sender_email' => $senderEmail,
            'subject' => $subject,
            $paramName => $paramValue,
            'list_id' => $bookId,
            'name' => $name,
            'attachments' => $attachments,
            'type' => $type,
        );

        $requestResult = $this->sendRequest('campaigns', 'POST', $data);

        return $this->handleResult($requestResult);
    }
public function createCampaign ( $ senderName , $ senderEmail , $ subject , $ bodyOrTemplateId , $ bookId , $ name = '' , $ attachments = '' , $ type = '' , $ useTemplateId = false ) { if ( empty ( $ senderName ) || empty ( $ senderEmail ) || empty ( $ subject ) || empty ( $ bodyOrTemplateId ) || empty ( $ bookId ) ) { return $ this -> handleError ( 'Not all data.' ) ; } if ( ! empty ( $ attachments ) ) { $ attachments = serialize ( $ attachments ) ; } if ( $ useTemplateId ) { $ paramName = 'template_id' ; $ paramValue = $ bodyOrTemplateId ; } else { $ paramName = 'body' ; $ paramValue = base64_encode ( $ bodyOrTemplateId ) ; } $ data = array ( 'sender_name' => $ senderName , 'sender_email' => $ senderEmail , 'subject' => $ subject , $ paramName => $ paramValue , 'list_id' => $ bookId , 'name' => $ name , 'attachments' => $ attachments , 'type' => $ type , ) ; $ requestResult = $ this -> sendRequest ( 'campaigns' , 'POST' , $ data ) ; return $ this -> handleResult ( $ requestResult ) ; }
Create new campaign

@param        $senderName
@param        $senderEmail
@param        $subject
@param        $bodyOrTemplateId
@param        $bookId
@param string $name
@param string $attachments
@param string $type
@param bool   $useTemplateId

@return mixed
Create new campaign