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


PHP BigTree::sendEmail方法代码示例

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


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

示例1: sendEmail

 function sendEmail($subject, $body, $to, $from_email = false, $from_name = false, $reply_to = false, $text = "")
 {
     // No from email? Use the no-reply address.
     if (!$from_email) {
         $from_email = "no-reply@" . (isset($_SERVER["HTTP_HOST"]) ? str_replace("www.", "", $_SERVER["HTTP_HOST"]) : str_replace(array("http://www.", "https://www.", "http://", "https://"), "", DOMAIN));
         $from_name = "BigTree CMS";
     }
     // Parse out from name and reply-to name
     $from = trim($from_email);
     if ($from_name === false && strpos($from, "<") !== false && substr($from, -1, 1) == ">") {
         $from_pieces = explode("<", $from);
         $from_name = trim($from_pieces[0]);
         $from_email = substr($from_pieces[1], 0, -1);
     }
     $reply = trim($reply_to);
     if (strpos($reply, "<") !== false && substr($reply, -1, 1) == ">") {
         $reply_pieces = explode("<", $reply);
         $reply_name = trim($reply_pieces[0]);
         $reply_to = substr($reply_pieces[1], 0, -1);
     }
     if ($this->Service == "local") {
         return BigTree::sendEmail($to, $subject, $body, $text, $from_name ? "{$from_name} <{$from_email}>" : $from_email, $reply_to);
     } elseif ($this->Service == "mandrill") {
         return $this->sendMandrill($subject, $body, $to, $from_email, $from_name, $reply_to, $text);
     } elseif ($this->Service == "mailgun") {
         return $this->sendMailgun($subject, $body, $to, $from_email, $from_name, $reply_to, $text);
     } elseif ($this->Service == "postmark") {
         return $this->sendPostmark($subject, $body, $to, $from_email, $from_name, $reply_to, $text);
     } elseif ($this->Service == "sendgrid") {
         return $this->sendSendGrid($subject, $body, $to, $from_email, $from_name, $reply_to, $text);
     } else {
         throw new Exception("Unknown Email Service");
     }
 }
开发者ID:kalle0045,项目名称:BigTree-CMS,代码行数:34,代码来源:email-service.php

示例2: forgotPassword

 static function forgotPassword($email)
 {
     global $bigtree;
     $home_page = sqlfetch(sqlquery("SELECT `nav_title` FROM `bigtree_pages` WHERE id = 0"));
     $site_title = $home_page["nav_title"];
     $email = sqlescape($email);
     $user = sqlfetch(sqlquery("SELECT * FROM bigtree_users WHERE email = '{$email}'"));
     if (!$user) {
         return false;
     }
     $hash = sqlescape(md5(md5(md5(uniqid("bigtree-hash" . microtime(true))))));
     sqlquery("UPDATE bigtree_users SET change_password_hash = '{$hash}' WHERE id = '" . $user["id"] . "'");
     $login_root = ($bigtree["config"]["force_secure_login"] ? str_replace("http://", "https://", ADMIN_ROOT) : ADMIN_ROOT) . "login/";
     $html = file_get_contents(BigTree::path("admin/email/reset-password.html"));
     $html = str_ireplace("{www_root}", WWW_ROOT, $html);
     $html = str_ireplace("{admin_root}", ADMIN_ROOT, $html);
     $html = str_ireplace("{site_title}", $site_title, $html);
     $html = str_ireplace("{reset_link}", $login_root . "reset-password/{$hash}/", $html);
     $es = new BigTreeEmailService();
     // Only use a custom email service if a from email has been set
     if ($es->Settings["bigtree_from"]) {
         $reply_to = "no-reply@" . (isset($_SERVER["HTTP_HOST"]) ? str_replace("www.", "", $_SERVER["HTTP_HOST"]) : str_replace(array("http://www.", "https://www.", "http://", "https://"), "", DOMAIN));
         $es->sendEmail("Reset Your Password", $html, $user["email"], $es->Settings["bigtree_from"], "BigTree CMS", $reply_to);
     } else {
         BigTree::sendEmail($user["email"], "Reset Your Password", $html);
     }
     BigTree::redirect($login_root . "forgot-success/");
     return true;
 }
开发者ID:kurt-planet,项目名称:BigTree-CMS,代码行数:29,代码来源:admin.php


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