當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MauticFactory::getMailer方法代碼示例

本文整理匯總了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();
 }
開發者ID:woakes070048,項目名稱:mautic,代碼行數:32,代碼來源:FormSubmitHelper.php

示例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();
     }
 }
開發者ID:spdaly,項目名稱:mautic,代碼行數:40,代碼來源:FormSubmitHelper.php

示例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);
     }
 }
開發者ID:Yame-,項目名稱:mautic,代碼行數:49,代碼來源:FormSubmitHelper.php


注:本文中的Mautic\CoreBundle\Factory\MauticFactory::getMailer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。