本文整理匯總了PHP中Mautic\CoreBundle\Factory\MauticFactory::getMailer方法的典型用法代碼示例。如果您正苦於以下問題:PHP MauticFactory::getMailer方法的具體用法?PHP MauticFactory::getMailer怎麽用?PHP MauticFactory::getMailer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getMailer方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendEmail
/**
* @param $action
*
* @return array
*/
public static function sendEmail($tokens, $config, MauticFactory $factory, $lead)
{
$mailer = $factory->getMailer();
$emails = !empty($config['to']) ? explode(',', $config['to']) : array();
$fields = $lead->getFields();
$email = $fields['core']['email']['value'];
if (!empty($email)) {
if ($config['copy_lead']) {
$emails[] = $email;
}
$mailer->setReplyTo($email);
}
$mailer->setTo($emails);
if (!empty($config['cc'])) {
$emails = explode(',', $config['cc']);
$mailer->setCc($emails);
}
if (!empty($config['bcc'])) {
$emails = explode(',', $config['bcc']);
$mailer->setBcc($emails);
}
$mailer->setSubject($config['subject']);
$mailer->setTokens($tokens);
$mailer->setBody($config['message']);
$mailer->parsePlainText($config['message']);
$mailer->send();
}
示例2: sendEmail
/**
* @param $tokens
* @param $config
* @param MauticFactory $factory
* @param Lead $lead
*/
public static function sendEmail($tokens, $config, MauticFactory $factory, Lead $lead)
{
$mailer = $factory->getMailer();
$emails = !empty($config['to']) ? explode(',', $config['to']) : array();
$mailer->setTo($emails);
$leadEmail = $lead->getEmail();
if (!empty($leadEmail)) {
// Reply to lead for user convenience
$mailer->setReplyTo($leadEmail);
}
if (!empty($config['cc'])) {
$emails = explode(',', $config['cc']);
$mailer->setCc($emails);
}
if (!empty($config['bcc'])) {
$emails = explode(',', $config['bcc']);
$mailer->setBcc($emails);
}
$mailer->setSubject($config['subject']);
$mailer->setTokens($tokens);
$mailer->setBody($config['message']);
$mailer->parsePlainText($config['message']);
$mailer->send();
if ($config['copy_lead'] && !empty($leadEmail)) {
// Send copy to lead
$mailer->reset();
$mailer->setTo($leadEmail);
$mailer->setSubject($config['subject']);
$mailer->setTokens($tokens);
$mailer->setBody($config['message']);
$mailer->parsePlainText($config['message']);
$mailer->send();
}
}
示例3: sendEmail
/**
* @param $tokens
* @param $config
* @param MauticFactory $factory
* @param Lead $lead
*/
public static function sendEmail($tokens, $config, MauticFactory $factory, Lead $lead)
{
// replace line brakes with <br> for textarea values
if ($tokens) {
foreach ($tokens as $token => &$value) {
$value = nl2br(html_entity_decode($value));
}
}
$leadEmail = $lead->getEmail();
$mailer = $factory->getMailer();
$emails = !empty($config['to']) ? array_fill_keys(explode(',', $config['to']), null) : [];
if (!empty($emails)) {
$mailer->setTo($emails);
if (!empty($leadEmail)) {
// Reply to lead for user convenience
$mailer->setReplyTo($leadEmail);
}
if (!empty($config['cc'])) {
$emails = array_fill_keys(explode(',', $config['cc']), null);
$mailer->setCc($emails);
}
if (!empty($config['bcc'])) {
$emails = array_fill_keys(explode(',', $config['bcc']), null);
$mailer->setBcc($emails);
}
$mailer->setSubject($config['subject']);
$mailer->addTokens($tokens);
$mailer->setBody($config['message']);
$mailer->parsePlainText($config['message']);
$mailer->send(true);
}
if ($config['copy_lead'] && !empty($leadEmail)) {
// Send copy to lead
$mailer->reset();
$mailer->setLead($lead->getProfileFields());
$mailer->setTo($leadEmail);
$mailer->setSubject($config['subject']);
$mailer->addTokens($tokens);
$mailer->setBody($config['message']);
$mailer->parsePlainText($config['message']);
$mailer->send(true);
}
}