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


PHP CRM_Mailing_Event_BAO_Queue::getDomain方法代码示例

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


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

示例1: send

 /**
  * Forward a mailing reply 
  *
  * @param int $queue_id     Queue event ID of the sender
  * @param string $mailing   The mailing object
  * @param string $body      Body of the message
  * @param string $replyto   Reply-to of the incoming message
  * @return void
  * @access public
  * @static
  */
 function send($queue_id, &$mailing, &$body, $replyto)
 {
     $config =& CRM_Core_Config::singleton();
     $mailer =& $config->getMailer();
     $domain =& CRM_Mailing_Event_BAO_Queue::getDomain($queue_id);
     $emails = CRM_Core_BAO_Email::getTableName();
     $eq = CRM_Mailing_Event_BAO_Queue::getTableName();
     $contacts = CRM_Contact_BAO_Contact::getTableName();
     $dao =& new CRM_Core_DAO();
     $dao->query("SELECT     {$contacts}.display_name as display_name,\n                                {$emails}.email as email\n                    FROM        {$eq}\n                    INNER JOIN  {$contacts}\n                            ON  {$eq}.contact_id = {$contacts}.id\n                    INNER JOIN  {$emails}\n                            ON  {$eq}.email_id = {$emails}.id\n                    WHERE       {$eq}.id = " . CRM_Utils_Type::escape($queue_id, 'Integer'));
     $dao->fetch();
     if (empty($dao->display_name)) {
         $from = $dao->email;
     } else {
         $from = "\"{$dao->display_name}\" <{$dao->email}>";
     }
     $message =& new Mail_Mime("\n");
     $headers = array('Subject' => "Re: {$mailing->subject}", 'To' => $mailing->replyto_email, 'From' => $from, 'Reply-To' => empty($replyto) ? $dao->email : $replyto, 'Return-Path' => "do-not-reply@{$domain->email_domain}");
     $message->setTxtBody($body);
     $b = $message->get();
     $h = $message->headers($headers);
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('CRM_Mailing_BAO_Mailing', 'catchSMTP'));
     $mailer->send($mailing->replyto_email, $h, $b);
     CRM_Core_Error::setCallback();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:36,代码来源:Reply.php

示例2: send_unsub_response

 /**
  * Send a reponse email informing the contact of the groups from which he
  * has been unsubscribed.
  *
  * @param string $queue_id      The queue event ID
  * @param array $groups         List of group IDs
  * @param bool $is_domain       Is this domain-level?
  * @param int $job              The job ID
  * @return void
  * @access public
  * @static
  */
 function send_unsub_response($queue_id, $groups, $is_domain = false, $job)
 {
     $config =& CRM_Core_Config::singleton();
     $domain =& CRM_Mailing_Event_BAO_Queue::getDomain($queue_id);
     $jobTable = CRM_Mailing_BAO_Job::getTableName();
     $mailingTable = CRM_Mailing_DAO_Mailing::getTableName();
     $contacts = CRM_Contact_DAO_Contact::getTableName();
     $email = CRM_Core_DAO_Email::getTableName();
     $queue = CRM_Mailing_Event_BAO_Queue::getTableName();
     $dao =& new CRM_Mailing_DAO_Mailing();
     $dao->query("   SELECT * FROM {$mailingTable} \n                        INNER JOIN {$jobTable} ON\n                            {$jobTable}.mailing_id = {$mailingTable}.id \n                        WHERE {$jobTable}.id = {$job}");
     $dao->fetch();
     $component =& new CRM_Mailing_BAO_Component();
     if ($is_domain) {
         $component->id = $dao->optout_id;
     } else {
         $component->id = $dao->unsubscribe_id;
     }
     $component->find(true);
     $html = $component->body_html;
     $text = $component->body_text;
     $eq =& new CRM_Core_DAO();
     $eq->query("SELECT     {$contacts}.preferred_mail_format as format,\n                    {$contacts}.id as contact_id,\n                    {$email}.email as email,\n                    {$queue}.hash as hash\n        FROM        {$contacts}\n        INNER JOIN  {$queue} ON {$queue}.contact_id = {$contacts}.id\n        INNER JOIN  {$email} ON {$queue}.email_id = {$email}.id\n        WHERE       {$queue}.id = " . CRM_Utils_Type::escape($queue_id, 'Integer'));
     $eq->fetch();
     $message =& new Mail_Mime("\n");
     require_once 'CRM/Utils/Token.php';
     if ($eq->format == 'HTML' || $eq->format == 'Both') {
         $html = CRM_Utils_Token::replaceDomainTokens($html, $domain, true);
         $html = CRM_Utils_Token::replaceUnsubscribeTokens($html, $domain, $groups, true, $eq->contact_id, $eq->hash);
         $message->setHTMLBody($html);
     }
     if (!$html || $eq->format == 'Text' || $eq->format == 'Both') {
         $text = CRM_Utils_Token::replaceDomainTokens($text, $domain, false);
         $text = CRM_Utils_Token::replaceUnsubscribeTokens($text, $domain, $groups, false, $eq->contact_id, $eq->hash);
         $message->setTxtBody($text);
     }
     $headers = array('Subject' => $component->subject, 'From' => ts('"%1 Administrator" <%2>', array(1 => $domain->name, 2 => "do-not-reply@{$domain->email_domain}")), 'To' => $eq->email, 'Reply-To' => "do-not-reply@{$domain->email_domain}", 'Return-Path' => "do-not-reply@{$domain->email_domain}");
     $b = $message->get();
     $h = $message->headers($headers);
     $mailer =& $config->getMailer();
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('CRM_Mailing_BAO_Mailing', 'catchSMTP'));
     $mailer->send($eq->email, $h, $b);
     CRM_Core_Error::setCallback();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:56,代码来源:Unsubscribe.php

示例3: elseif

 /**
  * Create a new forward event, create a new contact if necessary
  */
 function &forward($job_id, $queue_id, $hash, $forward_email)
 {
     $q =& CRM_Mailing_Event_BAO_Queue::verify($job_id, $queue_id, $hash);
     if (!$q) {
         return null;
     }
     /* Find the email address/contact, if it exists */
     $contact = CRM_Contact_BAO_Contact::getTableName();
     $location = CRM_Core_BAO_Location::getTableName();
     $email = CRM_Core_BAO_Email::getTableName();
     $queueTable = CRM_Mailing_Event_BAO_Queue::getTableName();
     $job = CRM_Mailing_BAO_Job::getTableName();
     $mailing = CRM_Mailing_BAO_Mailing::getTableName();
     $forward = CRM_Mailing_Event_BAO_Forward::getTableName();
     $domain =& CRM_Mailing_Event_BAO_Queue::getDomain($queue_id);
     $dao =& new CRM_Core_Dao();
     $dao->query("\n                SELECT      {$contact}.id as contact_id,\n                            {$email}.id as email_id,\n                            {$contact}.do_not_email as do_not_email,\n                            {$queueTable}.id as queue_id\n                FROM        {$email}, {$job} as temp_job\n                INNER JOIN  {$location}\n                        ON  {$email}.location_id = {$location}.id\n                INNER JOIN  {$contact}\n                        ON  {$location}.entity_table = '{$contact}'\n                        AND {$location}.entity_id = {$contact}.id\n                LEFT JOIN   {$queueTable}\n                        ON  {$email}.id = {$queueTable}.email_id\n                LEFT JOIN   {$job}\n                        ON  {$queueTable}.job_id = {$job}.id\n                        AND temp_job.mailing_id = {$job}.mailing_id\n                WHERE       temp_job.id = {$job_id}\n                    AND     {$email}.email = '" . CRM_Utils_Type::escape($forward_email, 'String') . "'");
     $dao->fetch();
     CRM_Core_DAO::transaction('BEGIN');
     if (isset($dao->queue_id) || $dao->do_not_email == 1) {
         /* We already sent this mailing to $forward_email, or we should
          * never email this contact.  Give up. */
         return false;
     } elseif (empty($dao->contact_id)) {
         /* No contact found, we'll have to create a new one */
         $contact_params = array('email' => $forward_email);
         $contact =& crm_create_contact($contact_params);
         if (is_a($contact, 'CRM_Core_Error')) {
             return false;
         }
         /* This is an ugly hack, but the API doesn't really support
          * overriding the domain ID any other way */
         $contact->domain_id = $domain->id;
         $contact->save();
         $contact_id = $contact->id;
         $email_id = $contact->location[1]->email[1]->id;
     } else {
         $contact_id = $dao->contact_id;
         $email_id = $dao->email_id;
     }
     /* Create a new queue event */
     $queue_params = array('email_id' => $email_id, 'contact_id' => $contact_id, 'job_id' => $job_id);
     $queue =& CRM_Mailing_Event_BAO_Queue::create($queue_params);
     $forward =& new CRM_Mailing_Event_BAO_Forward();
     $forward->time_stamp = date('YmdHis');
     $forward->event_queue_id = $queue_id;
     $forward->dest_queue_id = $queue->id;
     $forward->save();
     $dao->reset();
     $dao->query("   SELECT  {$job}.mailing_id as mailing_id \n                        FROM    {$job}\n                        WHERE   {$job}.id = " . CRM_Utils_Type::escape($job_id, 'Integer'));
     $dao->fetch();
     $mailing_obj =& new CRM_Mailing_BAO_Mailing();
     $mailing_obj->id = $dao->mailing_id;
     $mailing_obj->find(true);
     $config =& CRM_Core_Config::singleton();
     $mailer =& $config->getMailer();
     $recipient = null;
     $message =& $mailing_obj->compose($job_id, $queue->id, $queue->hash, $queue->contact_id, $forward_email, $recipient);
     $body = $message->get();
     $headers = $message->headers();
     PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array('CRM_Mailing_BAO_Mailing', 'catchSMTP'));
     $result = $mailer->send($recipient, $headers, $body);
     CRM_Core_Error::setCallback();
     $params = array('event_queue_id' => $queue->id, 'job_id' => $job_id, 'hash' => $queue->hash);
     if (is_a($result, PEAR_Error)) {
         /* Register the bounce event */
         $params = array_merge($params, CRM_Mailing_BAO_BouncePattern::match($result->getMessage()));
         CRM_Mailing_Event_BAO_Bounce::create($params);
     } else {
         /* Register the delivery event */
         CRM_Mailing_Event_BAO_Delivered::create($params);
     }
     CRM_Core_DAO::transaction('COMMIT');
     return true;
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:78,代码来源:Forward.php


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