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


PHP RSMembershipHelper::sendMail方法代码示例

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


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

示例1: sendNotifications


//.........这里部分代码省略.........
                 $name = $field->name;
                 $replace[] = '{' . $name . '}';
                 if (isset($user_data[$name])) {
                     $with[] = is_array($user_data[$name]) ? implode("\n", $user_data[$name]) : $user_data[$name];
                 } else {
                     $with[] = '';
                 }
             }
             $membership_fields = RSMembership::getCustomMembershipFields($membership->id);
             $transaction_user_data = RSMembership::getUserData($result->from_transaction_id);
             foreach ($membership_fields as $field) {
                 $name = $field->name;
                 $replace[] = '{' . $name . '}';
                 if (isset($transaction_user_data->membership_fields[$name])) {
                     $with[] = is_array($transaction_user_data->membership_fields[$name]) ? implode("\n", $transaction_user_data->membership_fields[$name]) : $transaction_user_data->membership_fields[$name];
                 } else {
                     $with[] = '';
                 }
             }
             $jconfig = JFactory::getConfig();
             if ($membership->user_email_expire_subject) {
                 $message = str_replace($replace, $with, $membership->user_email_expire_text);
                 // from address
                 $from = $membership->user_email_use_global ? $jconfig->get('mailfrom') : $membership->user_email_from_addr;
                 // from name
                 $fromName = $membership->user_email_use_global ? $jconfig->get('fromname') : $membership->user_email_from;
                 // recipient
                 $recipient = $result->user_email;
                 // user email
                 // subject
                 $subject = str_replace($replace, $with, $membership->user_email_expire_subject);
                 // body
                 $body = $message;
                 // mode
                 $mode = $membership->user_email_mode;
                 // cc
                 $cc = null;
                 // bcc
                 $bcc = null;
                 // attachments
                 $query->clear();
                 $query->select($db->qn('path'))->from($db->qn('#__rsmembership_membership_attachments'))->where($db->qn('membership_id') . ' = ' . $db->q($membership->id))->where($db->qn('email_type') . ' = ' . $db->q('user_email_expire'))->where($db->qn('published') . '=' . $db->q('1'))->order($db->qn('ordering') . ' ASC');
                 $db->setQuery($query);
                 $attachment = $db->loadColumn();
                 // reply to
                 $replyto = $from;
                 // reply to name
                 $replytoname = $fromName;
                 // send to user
                 RSMembershipHelper::sendMail($from, $fromName, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);
                 $sentToUser = true;
                 self::syslog('expiry-notification', "Membership: " . $membership->name . " (" . $membership->id . ") | Email sent to {$recipient} (Subject: {$subject})");
             }
             // admin emails
             if ($membership->admin_email_expire_subject) {
                 $message = str_replace($replace, $with, $membership->admin_email_expire_text);
                 // from address
                 $from = trim($membership->admin_email_from_addr) != '' ? $membership->admin_email_from_addr : $result->user_email;
                 // from name
                 $fromName = $result->user_name;
                 // recipient
                 $recipient = $membership->admin_email_to_addr;
                 // subject
                 $subject = str_replace($replace, $with, $membership->admin_email_expire_subject);
                 // body
                 $body = $message;
                 // mode
                 $mode = $membership->admin_email_mode;
                 // cc
                 $cc = null;
                 // bcc
                 $bcc = null;
                 // attachments
                 $attachment = null;
                 // reply to
                 $replyto = $from;
                 // reply to name
                 $replytoname = $fromName;
                 // send to admin
                 if ($subject != '') {
                     RSMembershipHelper::sendMail($from, $fromName, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname);
                     $sentToAdmin = true;
                     self::syslog('expiry-notification', "Membership: " . $membership->name . " (" . $membership->id . ") | Admin email sent to {$recipient} (Subject: {$subject})");
                 }
             }
             if ($sentToUser || $sentToAdmin) {
                 $update_ids[] = $result->muid;
             }
         }
     }
     if (!empty($update_ids)) {
         $query->clear();
         $query->update($db->qn('#__rsmembership_membership_subscribers'))->set($db->qn('notified') . ' = ' . $db->q($date->toSql()))->where($db->qn('id') . ' IN (\'' . implode($db->q(','), $update_ids) . '\')');
         $db->setQuery($query);
         $db->execute();
         return true;
     } else {
         return false;
     }
 }
开发者ID:JozefAB,项目名称:qk,代码行数:101,代码来源:rsmembership.php

示例2: approve


//.........这里部分代码省略.........
     $user_email = $transaction->user_email;
     $replace = array('{membership}', '{email}', '{username}', '{name}');
     $with = array($membership->name, $user_email, isset($user_data->username) ? $user_data->username : '', $user_data->name);
     $db->setQuery("SELECT * FROM #__rsmembership_fields WHERE published='1'");
     $fields = $db->loadObjectList();
     foreach ($fields as $field) {
         $name = $field->name;
         $replace[] = '{' . $name . '}';
         if (isset($user_data->fields[$name])) {
             $with[] = is_array($user_data->fields[$name]) ? implode("\n", $user_data->fields[$name]) : $user_data->fields[$name];
         } else {
             $with[] = '';
         }
     }
     if ($update_rsmail) {
         RSMembership::addToRSMail($update_rsmail, $row->user_id, $user_email, $user_data);
     }
     $userEmail = array('from' => '', 'fromName' => '', 'recipient' => '', 'subject' => '', 'body' => '', 'mode' => '', 'cc' => '', 'bcc' => '', 'attachments' => '', 'replyto' => '', 'replytoname' => '');
     $adminEmail = array('from' => '', 'fromName' => '', 'recipient' => '', 'subject' => '', 'body' => '', 'mode' => '', 'cc' => '', 'bcc' => '', 'attachments' => '', 'replyto' => '', 'replytoname' => '');
     $jconfig = JFactory::getConfig();
     $membership->user_email_from_addr = $membership->user_email_use_global ? $jconfig->getValue('config.mailfrom') : $membership->user_email_from_addr;
     $membership->user_email_from = $membership->user_email_use_global ? $jconfig->getValue('config.fromname') : $membership->user_email_from;
     if (!empty($membership->user_email_from_addr) && $membership->user_email_approved_subject != '') {
         // start sending emails
         // from address
         $userEmail['from'] = $membership->user_email_from_addr;
         // from name
         $userEmail['fromName'] = $membership->user_email_from;
         // recipient
         $userEmail['recipient'] = $user_email;
         // user email
         // subject
         $userEmail['subject'] = str_replace($replace, $with, $membership->user_email_approved_subject);
         // body
         $userEmail['body'] = str_replace($replace, $with, $membership->user_email_approved_text);
         // mode
         $userEmail['mode'] = $membership->user_email_mode;
         // cc
         $userEmail['cc'] = null;
         // bcc
         $userEmail['bcc'] = null;
         // attachments
         $db->setQuery("SELECT `path` FROM #__rsmembership_membership_attachments WHERE `membership_id`='" . $membership->id . "' AND `email_type`='user_email_approved' AND `published`='1' ORDER BY `ordering`");
         $userEmail['attachments'] = $db->loadResultArray();
         // reply to
         $userEmail['replyto'] = $userEmail['from'];
         // reply to name
         $userEmail['replytoname'] = $userEmail['fromName'];
     }
     // admin emails
     if (!empty($membership->admin_email_to_addr) && $membership->admin_email_approved_subject != '') {
         // from address
         $adminEmail['from'] = $user_email;
         // from name
         $adminEmail['fromName'] = $user_data->name;
         // recipient
         $adminEmail['recipient'] = $membership->admin_email_to_addr;
         // subject
         $adminEmail['subject'] = str_replace($replace, $with, $membership->admin_email_approved_subject);
         // body
         $adminEmail['body'] = str_replace($replace, $with, $membership->admin_email_approved_text);
         // mode
         $adminEmail['mode'] = $membership->admin_email_mode;
         // cc
         $adminEmail['cc'] = null;
         // bcc
         $adminEmail['bcc'] = null;
         // attachments
         $adminEmail['attachments'] = null;
         // reply to
         $adminEmail['replyto'] = $adminEmail['from'];
         // reply to name
         $adminEmail['replytoname'] = $adminEmail['fromName'];
     }
     // run php code
     eval($membership->custom_code_transaction);
     // send to user
     if (!empty($membership->user_email_from_addr) && $membership->user_email_approved_subject != '') {
         RSMembershipHelper::sendMail($userEmail['from'], $userEmail['fromName'], $userEmail['recipient'], $userEmail['subject'], $userEmail['body'], $userEmail['mode'], $userEmail['cc'], $userEmail['bcc'], $userEmail['attachments'], $userEmail['replyto'], $userEmail['replytoname']);
     }
     // send to admin
     if (!empty($membership->admin_email_to_addr) && !empty($membership->admin_email_approved_subject)) {
         RSMembershipHelper::sendMail($adminEmail['from'], $adminEmail['fromName'], $adminEmail['recipient'], $adminEmail['subject'], $adminEmail['body'], $adminEmail['mode'], $adminEmail['cc'], $adminEmail['bcc'], $adminEmail['attachments'], $adminEmail['replyto'], $adminEmail['replytoname']);
     }
     // process stock
     if ($membership->stock > 0) {
         // decrease stock
         if ($membership->stock > 1) {
             $db->setQuery("UPDATE #__rsmembership_memberships SET `stock`=`stock`-1 WHERE `id`='" . $membership->id . "'");
         } else {
             $db->setQuery("UPDATE #__rsmembership_memberships SET `stock`='-1' WHERE `id`='" . $membership->id . "'");
         }
         $db->query();
     }
     if ($update_idev) {
         RSMembership::updateIdev(array('idev_saleamt' => $transaction->price, 'idev_ordernum' => $transaction->id, 'ip_address' => $transaction->ip));
     }
     // should return the newly created/updated membership id
     return $return;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:rsmembership.php


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