本文整理匯總了PHP中MCAPI::campaignSendNow方法的典型用法代碼示例。如果您正苦於以下問題:PHP MCAPI::campaignSendNow方法的具體用法?PHP MCAPI::campaignSendNow怎麽用?PHP MCAPI::campaignSendNow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MCAPI
的用法示例。
在下文中一共展示了MCAPI::campaignSendNow方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: notify
/**
* Creates a new campaign and send it immediately.
*
* @since 3.7
* @access public
*/
public function notify($emailTitle, $emailData, &$blog)
{
JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
$config = EasyBlogHelper::getConfig();
if (!function_exists('curl_init')) {
echo JText::_('COM_EASYBLOG_CURL_DOES_NOT_EXIST');
}
if (!$config->get('subscription_mailchimp')) {
return;
}
$listId = $config->get('subscription_mailchimp_listid');
if (!$listId) {
return;
}
require_once EBLOG_CLASSES . '/MCAPI.class.php';
$api = new MCAPI($this->key);
$type = 'regular';
$jConfig = EasyBlogHelper::getJConfig();
$defaultEmailFrom = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? $jConfig->get('mailfrom') : $jConfig->get('mailfrom');
$defaultFromName = EasyBlogHelper::getJoomlaVersion() >= '1.6' ? $jConfig->get('fromname') : $jConfig->get('fromname');
$fromEmail = $config->get('mailchimp_from_email', $defaultEmailFrom);
$fromName = $config->get('mailchimp_from_name', $defaultFromName);
$opts = array();
$opts['list_id'] = $listId;
$opts['from_email'] = $fromEmail;
$opts['from_name'] = $fromName;
$opts['subject'] = $emailTitle;
$opts['tracking'] = array('opens' => true, 'html_clicks' => true, 'text_clicks' => false);
$opts['authenticate'] = true;
$opts['title'] = $blog->title;
$content = array('html' => self::getTemplateContents('email.blog.new', $emailData, 'html'), 'text' => self::getTemplateContents('email.blog.new', $emailData, 'text'));
$cid = $api->campaignCreate($type, $opts, $content);
// Send this now!
if (!$api->errorCode) {
$api->campaignSendNow($cid);
}
}
示例2: array
/** OR we could use this:
$content = array('html_main'=>'some pretty html content',
'html_sidecolumn' => 'this goes in a side column',
'html_header' => 'this gets placed in the header',
'html_footer' => 'the footer with an *|UNSUB|* message',
'text' => 'text content text content *|UNSUB|*'
);
$opts['template_id'] = "1";
**/
$campaignId = $api->campaignCreate($type, $opts, $content);
if ($api->errorCode) {
echo "Unable to Create New Campaign!";
echo "\n\tCode=" . $api->errorCode;
echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
echo "New Campaign ID:" . $campaignId . "\n";
}
// on could do this;
// it is probably a good idea
// to click on that "send" button
// in the mailchimp panel
$retval = $api->campaignSendNow($campaignId);
if ($api->errorCode) {
echo "Unable to Send Campaign!";
echo "\n\tCode=" . $api->errorCode;
echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
echo "Campaign Sent!\n";
}
logger("Done: mygassi-mc-action-campaign.php");
exit(1);