当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Utils_Mail::encodeAddressHeader方法代码示例

本文整理汇总了PHP中CRM_Utils_Mail::encodeAddressHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Mail::encodeAddressHeader方法的具体用法?PHP CRM_Utils_Mail::encodeAddressHeader怎么用?PHP CRM_Utils_Mail::encodeAddressHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Utils_Mail的用法示例。


在下文中一共展示了CRM_Utils_Mail::encodeAddressHeader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendEmail

 /**
  * send the message to all the contacts and also insert a
  * contact activity in each contacts record
  *
  * @param array  $contactIds   the array of contact ids to send the email
  * @param string $subject      the subject of the message
  * @param string $message      the message contents
  * @param string $emailAddress use this 'to' email address instead of the default Primary address
  *
  * @return array             (total, added, notAdded) count of emails sent
  * @access public
  * @static
  */
 function sendEmail(&$contactIds, &$subject, &$message, $emailAddress)
 {
     $session =& CRM_Core_Session::singleton();
     $userID = $session->get('userID');
     list($fromDisplayName, $fromEmail, $fromDoNotEmail) = CRM_Contact_BAO_Contact::getContactDetails($userID);
     if (!$fromEmail) {
         return array(count($contactIds), 0, count($contactIds));
     }
     if (!trim($fromDisplayName)) {
         $fromDisplayName = $fromEmail;
     }
     $from = CRM_Utils_Mail::encodeAddressHeader($fromDisplayName, $fromEmail);
     // create the meta level record first
     $email =& new CRM_Core_BAO_EmailHistory();
     $email->subject = $subject;
     $email->message = $message;
     $email->contact_id = $userID;
     $email->sent_date = date('Ymd');
     $email->save();
     $sent = $notSent = 0;
     foreach ($contactIds as $contactId) {
         if (CRM_Core_BAO_EmailHistory::sendMessage($from, $contactId, $subject, $message, $emailAddress, $email->id)) {
             $sent++;
         } else {
             $notSent++;
         }
     }
     return array(count($contactIds), $sent, $notSent);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:42,代码来源:EmailHistory.php

示例2: send

 function send($from, $toDisplayName, $toEmail, $subject, $message, $cc = null, $bcc = null)
 {
     require_once 'CRM/Core/DAO/Domain.php';
     $dao = new CRM_Core_DAO_Domain();
     $dao->id = 1;
     $dao->find(true);
     $returnPath = $dao->email_return_path;
     if (!$returnPath) {
         $returnPath = CRM_Utils_Mail::_pluckEmailFromHeader($from);
     }
     $headers = array();
     $headers['From'] = $from;
     $headers['To'] = CRM_Utils_Mail::encodeAddressHeader($toDisplayName, $toEmail);
     $headers['Cc'] = $cc;
     $headers['Bcc'] = $bcc;
     $headers['Subject'] = CRM_Utils_Mail::encodeSubjectHeader($subject);
     $headers['Content-Type'] = 'text/plain; charset=utf-8';
     $headers['Content-Disposition'] = 'inline';
     $headers['Content-Transfer-Encoding'] = '8bit';
     $headers['Return-Path'] = $returnPath;
     $headers['Reply-To'] = $from;
     $to = array($toEmail);
     if ($cc) {
         $to[] = $cc;
     }
     if ($bcc) {
         $to[] = $bcc;
     }
     $mailer =& CRM_Core_Config::getMailer();
     if ($mailer->send($to, $headers, $message) !== true) {
         return false;
     }
     return true;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:34,代码来源:Mail.php


注:本文中的CRM_Utils_Mail::encodeAddressHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。