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


PHP CRM_Mailing_Event_BAO_Bounce::save方法代码示例

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


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

示例1: date

 /**
  * Create a new bounce event, update the email address if necessary
  */
 static function &create(&$params)
 {
     $q =& CRM_Mailing_Event_BAO_Queue::verify($params['job_id'], $params['event_queue_id'], $params['hash']);
     $success = NULL;
     if (!$q) {
         return $success;
     }
     $transaction = new CRM_Core_Transaction();
     $bounce = new CRM_Mailing_Event_BAO_Bounce();
     $bounce->time_stamp = date('YmdHis');
     // if we dont have a valid bounce type, we should set it
     // to bounce_type_id 11 which is Syntax error. this allows such email
     // addresses to be bounce a few more time before being put on hold
     // CRM-4814
     // we changed this behavior since this bounce type might be due to some issue
     // with the connection or smtp server etc
     if (empty($params['bounce_type_id'])) {
         $params['bounce_type_id'] = 11;
         if (empty($params['bounce_reason'])) {
             $params['bounce_reason'] = ts('Unknown bounce type: Could not parse bounce email');
         }
     }
     // CRM-11989
     $params['bounce_reason'] = substr($params['bounce_reason'], 0, 254);
     $bounce->copyValues($params);
     $bounce->save();
     $success = TRUE;
     $bounceTable = CRM_Mailing_Event_BAO_Bounce::getTableName();
     $bounceType = CRM_Mailing_DAO_BounceType::getTableName();
     $emailTable = CRM_Core_BAO_Email::getTableName();
     $queueTable = CRM_Mailing_Event_BAO_Queue::getTableName();
     $bounce->reset();
     // might want to put distinct inside the count
     $query = "SELECT     count({$bounceTable}.id) as bounces,\n                            {$bounceType}.hold_threshold as threshold\n                FROM        {$bounceTable}\n                INNER JOIN  {$bounceType}\n                        ON  {$bounceTable}.bounce_type_id = {$bounceType}.id\n                INNER JOIN  {$queueTable}\n                        ON  {$bounceTable}.event_queue_id = {$queueTable}.id\n                INNER JOIN  {$emailTable}\n                        ON  {$queueTable}.email_id = {$emailTable}.id\n                WHERE       {$emailTable}.id = {$q->email_id}\n                    AND     ({$emailTable}.reset_date IS NULL\n                        OR  {$bounceTable}.time_stamp >= {$emailTable}.reset_date)\n                GROUP BY    {$bounceTable}.bounce_type_id\n                ORDER BY    threshold, bounces desc";
     $bounce->query($query);
     while ($bounce->fetch()) {
         if ($bounce->bounces >= $bounce->threshold) {
             $email = new CRM_Core_BAO_Email();
             $email->id = $q->email_id;
             $email->on_hold = TRUE;
             $email->hold_date = date('YmdHis');
             $email->save();
             break;
         }
     }
     $transaction->commit();
     return $success;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:51,代码来源:Bounce.php

示例2: date

 /**
  * Create a new bounce event, update the email address if necessary
  */
 static function &create(&$params)
 {
     $q =& CRM_Mailing_Event_BAO_Queue::verify($params['job_id'], $params['event_queue_id'], $params['hash']);
     $success = null;
     if (!$q) {
         return $success;
     }
     require_once 'CRM/Core/Transaction.php';
     $transaction = new CRM_Core_Transaction();
     $bounce = new CRM_Mailing_Event_BAO_Bounce();
     $bounce->time_stamp = date('YmdHis');
     // if we dont have a valid bounce type, we should set it
     // to bounce_type_id 6 which is Invalid. this allows such email
     // addresses to be put on hold immediately, CRM-4814
     if (empty($params['bounce_type_id'])) {
         $params['bounce_type_id'] = 6;
         $params['bounce_reason'] = ts('Unknown bounce type: Could not parse bounce email');
     }
     $bounce->copyValues($params);
     $bounce->save();
     $success = true;
     $bounceTable = CRM_Mailing_Event_BAO_Bounce::getTableName();
     $bounceType = CRM_Mailing_DAO_BounceType::getTableName();
     $emailTable = CRM_Core_BAO_Email::getTableName();
     $queueTable = CRM_Mailing_Event_BAO_Queue::getTableName();
     $bounce->reset();
     // might want to put distinct inside the count
     $query = "SELECT     count({$bounceTable}.id) as bounces,\n                            {$bounceType}.hold_threshold as threshold\n                FROM        {$bounceTable}\n                INNER JOIN  {$bounceType}\n                        ON  {$bounceTable}.bounce_type_id = {$bounceType}.id\n                INNER JOIN  {$queueTable}\n                        ON  {$bounceTable}.event_queue_id = {$queueTable}.id\n                INNER JOIN  {$emailTable}\n                        ON  {$queueTable}.email_id = {$emailTable}.id\n                WHERE       {$emailTable}.id = {$q->email_id}\n                    AND     ({$emailTable}.reset_date IS NULL\n                        OR  {$bounceTable}.time_stamp >= {$emailTable}.reset_date)\n                GROUP BY    {$bounceTable}.bounce_type_id\n                ORDER BY    threshold, bounces desc";
     $bounce->query($query);
     while ($bounce->fetch()) {
         if ($bounce->bounces >= $bounce->threshold) {
             $email = new CRM_Core_BAO_Email();
             $email->id = $q->email_id;
             $email->on_hold = true;
             $email->hold_date = date('YmdHis');
             $email->save();
             break;
         }
     }
     $transaction->commit();
     return $success;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:45,代码来源:Bounce.php

示例3: recordBounce

 static function recordBounce($params)
 {
     $isSpam = CRM_Utils_Array::value('is_spam', $params);
     $mailingId = CRM_Utils_Array::value('mailing_id', $params);
     //CiviCRM mailling ID
     $contactId = CRM_Utils_Array::value('contact_id', $params);
     $emailId = CRM_Utils_Array::value('email_id', $params);
     $email = CRM_Utils_Array::value('email', $params);
     $jobId = CRM_Utils_Array::value('job_id', $params);
     $eqParams = array('job_id' => $jobId, 'contact_id' => $contactId, 'email_id' => $emailId);
     $eventQueue = CRM_Mailing_Event_BAO_Queue::create($eqParams);
     $time = date('YmdHis', CRM_Utils_Array::value('date_ts', $params));
     $bounceType = array();
     CRM_Core_PseudoConstant::populate($bounceType, 'CRM_Mailing_DAO_BounceType', TRUE, 'id', NULL, NULL, NULL, 'name');
     $bounce = new CRM_Mailing_Event_BAO_Bounce();
     $bounce->time_stamp = $time;
     $bounce->event_queue_id = $eventQueue->id;
     if ($isSpam) {
         $bounce->bounce_type_id = $bounceType[CRM_Mailjet_Upgrader::SPAM];
         $bounce->bounce_reason = CRM_Utils_Array::value('source', $params);
         //bounce reason when spam occured
     } else {
         $hardBounce = CRM_Utils_Array::value('hard_bounce', $params);
         $blocked = CRM_Utils_Array::value('blocked', $params);
         //  blocked : true if this bounce leads to recipient being blocked
         if ($hardBounce && $blocked) {
             $bounce->bounce_type_id = $bounceType[CRM_Mailjet_Upgrader::BLOCKED];
         } elseif ($hardBounce && !$blocked) {
             $bounce->bounce_type_id = $bounceType[CRM_Mailjet_Upgrader::HARD_BOUNCE];
         } else {
             $bounce->bounce_type_id = $bounceType[CRM_Mailjet_Upgrader::SOFT_BOUNCE];
         }
         $bounce->bounce_reason = $params['error_related_to'] . " - " . $params['error'];
     }
     $bounce->save();
     if ($bounce->bounce_type_id != $bounceType[CRM_Mailjet_Upgrader::SOFT_BOUNCE]) {
         $params = array('id' => $contactId, 'do_not_email' => 1);
         civicrm_api3('Contact', 'create', $params);
     }
     return TRUE;
 }
开发者ID:WeMoveEU,项目名称:uk.co.compucorp.civicrm.mailjet,代码行数:41,代码来源:Event.php


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