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


PHP sp_send_email函数代码示例

本文整理汇总了PHP中sp_send_email函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_send_email函数的具体用法?PHP sp_send_email怎么用?PHP sp_send_email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _send_to_active

 protected function _send_to_active()
 {
     $option = M('Options')->where(array('option_name' => 'member_email_active'))->find();
     if (!$option) {
         $this->error('网站未配置账号激活信息,请联系网站管理员');
     }
     $options = json_decode($option['option_value'], true);
     //邮件标题
     $title = $options['title'];
     $uid = $_SESSION['user']['id'];
     $username = $_SESSION['user']['user_login'];
     $activekey = md5($uid . time() . uniqid());
     $users_model = M("Users");
     $result = $users_model->where(array("id" => $uid))->save(array("user_activation_key" => $activekey));
     if (!$result) {
         $this->error('激活码生成失败!');
     }
     //生成激活链接
     $url = U('user/register/active', array("hash" => $activekey), "", true);
     //邮件内容
     $template = $options['template'];
     $content = str_replace(array('http://#link#', '#username#'), array($url, $username), $template);
     $send_result = sp_send_email($_SESSION['user']['user_email'], $title, $content);
     if ($send_result['error']) {
         $this->error('激活邮件发送失败,请尝试登录后,手动发送激活邮件!');
     }
 }
开发者ID:xiaoxianlink,项目名称:ziniu,代码行数:27,代码来源:HomeBaseController.class.php

示例2: _send_to_resetpass

    protected function _send_to_resetpass($user)
    {
        $options = get_site_options();
        //邮件标题
        $title = $options['site_name'] . "密码重置";
        $uid = $user['id'];
        $username = $user['user_login'];
        $activekey = md5($uid . time() . uniqid());
        $users_model = M("Users");
        $result = $users_model->where(array("id" => $uid))->save(array("user_activation_key" => $activekey));
        if (!$result) {
            $this->error('密码重置激活码生成失败!');
        }
        //生成激活链接
        $url = U('user/login/password_reset', array("hash" => $activekey), "", true);
        //邮件内容
        $template = <<<hello
\t\t#username#,你好!<br>
\t\t请点击或复制下面链接进行密码重置:<br>
\t\t<a href="http://#link#">http://#link#</a>
hello;
        $content = str_replace(array('http://#link#', '#username#'), array($url, $username), $template);
        $send_result = sp_send_email($user['user_email'], $title, $content);
        if ($send_result['error']) {
            $this->error('密码重置邮件发送失败!');
        }
    }
开发者ID:lvxiaolin,项目名称:thinkcfm,代码行数:27,代码来源:LoginController.class.php

示例3: wp_new_user_notification

 function wp_new_user_notification($user_id, $notify = '')
 {
     $user = new WP_User($user_id);
     $sflogin = sp_get_option('sflogin');
     $eol = "\r\n";
     $user_login = $user->user_login;
     $user_email = $user->user_email;
     $message = '';
     $message .= sp_text_noesc('New user registration on your website') . ': ' . get_option('blogname') . $eol . $eol;
     $message .= sp_text_noesc('Username') . ': ' . $user_login . $eol;
     $message .= sp_text_noesc('E-mail') . ': ' . $user_email . $eol;
     $message .= sp_text_noesc('Registration IP') . ': ' . sp_get_ip() . $eol;
     $address = apply_filters('sph_admin_new_user_email_addrress', get_option('admin_email'), $user_id);
     $subject = apply_filters('sph_admin_new_user_email_subject', get_option('blogname') . ' ' . sp_text_noesc('New User Registration'), $user_id);
     $msg = apply_filters('sph_admin_new_user_email_msg', $message, $user_id);
     sp_send_email($address, $subject, $msg);
     if ('admin' === $notify || empty($notify)) {
         return;
     }
     # Generate something random for a password reset key.
     $key = wp_generate_password(20, false);
     /** This action is documented in wp-login.php */
     do_action('retrieve_password_key', $user_login, $key);
     # Now insert the key, hashed, into the DB.
     if (empty($wp_hasher)) {
         require_once ABSPATH . WPINC . '/class-phpass.php';
         $wp_hasher = new PasswordHash(8, true);
     }
     $hashed = time() . ':' . $wp_hasher->HashPassword($key);
     global $wpdb;
     $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user_login));
     $mailoptions = sp_get_option('sfnewusermail');
     $subject = stripslashes($mailoptions['sfnewusersubject']);
     $body = stripslashes($mailoptions['sfnewusertext']);
     if (empty($subject) || empty($body)) {
         $subject = get_option('blogname') . ' ' . sp_text_noesc('Your username') . $eol . $eol;
         $body = sp_text_noesc('Username') . ': ' . $user_login . $eol;
         $body .= sp_text_noesc('Login URL') . ': ' . $sflogin['sfloginemailurl'] . $eol;
         $body .= sp_text_noesc('Password Reset URL') . ': ' . network_site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user_login), 'login') . $eol;
     } else {
         $blogname = get_bloginfo('name');
         $subject = str_replace('%USERNAME%', $user_login, $subject);
         $subject = str_replace('%BLOGNAME%', $blogname, $subject);
         $subject = str_replace('%SITEURL%', sp_url(), $subject);
         $subject = str_replace('%LOGINURL%', $sflogin['sfloginemailurl'], $subject);
         $subject = str_replace('%PWURL%', network_site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user_login), 'login'), $subject);
         $body = str_replace('%USERNAME%', $user_login, $body);
         $body = str_replace('%BLOGNAME%', $blogname, $body);
         $body = str_replace('%SITEURL%', sp_url(), $body);
         $body = str_replace('%LOGINURL%', $sflogin['sfloginemailurl'], $body);
         $body = str_replace('%PWURL%', network_site_url("wp-login.php?action=rp&key={$key}&login=" . rawurlencode($user_login), 'login'), $body);
         $body = str_replace('%NEWLINE%', $eol, $body);
     }
     str_replace('<br />', $eol, $body);
     $address = apply_filters('sph_user_new_user_email_addrress', $user_email, $user_id);
     $subject = apply_filters('sph_user_new_user_email_subject', get_option('blogname') . ' ' . sp_text_noesc('New User Registration'), $user_id);
     $msg = apply_filters('sph_user_new_user_email_msg', $body, $user_id, $user_pass);
     sp_send_email($user_email, $subject, $msg);
 }
开发者ID:bself,项目名称:nuimage-wp,代码行数:59,代码来源:sp-new-user-email.php

示例4: sp_email_notifications

function sp_email_notifications($newpost)
{
    global $spGlobals, $spThisUser, $spVars;
    $out = '';
    $email_status = array();
    $eol = "\r\n";
    $tab = "\t";
    # create the email address list for admin nptifications
    $admins_email = array();
    $admins = spdb_table(SFMEMBERS, 'admin = 1 OR moderator = 1');
    if ($admins) {
        foreach ($admins as $admin) {
            if ($admin->user_id != $newpost['userid']) {
                $admin_opts = unserialize($admin->admin_options);
                if ($admin_opts['sfnotify'] && sp_get_auth('moderate_posts', $newpost['forumid'], $admin->user_id)) {
                    $email = spdb_table(SFUSERS, "ID = " . $admin->user_id, 'user_email');
                    $admins_email[$admin->user_id] = $email;
                }
            }
        }
    }
    $admins_email = apply_filters('sph_admin_email_addresses', $admins_email);
    # send the emails
    if (!empty($admins_email)) {
        # clean up the content for the plain text email - go get it from database so not in 'save' mode
        $post_content = spdb_table(SFPOSTS, 'post_id=' . $newpost['postid'], 'post_content');
        $post_content = sp_filter_email_content($post_content);
        # create message body
        $msg = sp_text('New forum post on your site') . ': ' . get_option('blogname') . $eol . $eol;
        $msg .= sp_text('From') . ': ' . $tab . $newpost['postername'] . ' [' . $newpost['posteremail'] . ']' . ', ' . sp_text('Poster IP') . ': ' . $newpost['posterip'] . $eol . $eol;
        $msg .= sp_text('Group') . ':' . $tab . sp_filter_title_display($newpost['groupname']) . $eol;
        $msg .= sp_text('Forum') . ':' . $tab . sp_filter_title_display($newpost['forumname']) . $eol;
        $msg .= sp_text('Topic') . ':' . $tab . sp_filter_title_display($newpost['topicname']) . $eol;
        $msg .= urldecode($newpost['url']) . $eol;
        $msg .= sp_text('Post') . ':' . $eol . $post_content . $eol . $eol;
        foreach ($admins_email as $id => $email) {
            $newmsg = apply_filters('sph_admin_email', $msg, $newpost, $id, 'admin');
            $replyto = apply_filters('sph_email_replyto', '', $newpost);
            $subject = sp_text('Forum Post') . ' - ' . get_option('blogname') . ': [' . sp_filter_title_display($newpost['topicname']) . ']';
            $subject = apply_filters('sph_email_subject', $subject, $newpost);
            sp_send_email($email, $subject, $newmsg, $replyto);
        }
        $out = '- ' . sp_text('Notified: Administrators/Moderators');
    }
    $out = apply_filters('sph_new_post_notifications', $out, $newpost);
    return $out;
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:47,代码来源:sp-post-support.php

示例5: wp_new_user_notification

 function wp_new_user_notification($user_id, $user_pass = '')
 {
     $user = new WP_User($user_id);
     $sflogin = sp_get_option('sflogin');
     $eol = "\r\n";
     $user_login = $user->user_login;
     $user_email = $user->user_email;
     $message = '';
     $message .= sp_text_noesc('New user registration on your website') . ': ' . get_option('blogname') . $eol . $eol;
     $message .= sp_text_noesc('Username') . ': ' . $user_login . $eol;
     $message .= sp_text_noesc('E-mail') . ': ' . $user_email . $eol;
     $message .= sp_text_noesc('Registration IP') . ': ' . sp_get_ip() . $eol;
     $address = apply_filters('sph_admin_new_user_email_addrress', get_option('admin_email'), $user_id);
     $subject = apply_filters('sph_admin_new_user_email_subject', get_option('blogname') . ' ' . sp_text_noesc('New User Registration'), $user_id);
     $msg = apply_filters('sph_admin_new_user_email_msg', $message, $user_id);
     sp_send_email($address, $subject, $msg);
     if (empty($user_pass)) {
         return;
     }
     $mailoptions = sp_get_option('sfnewusermail');
     $subject = stripslashes($mailoptions['sfnewusersubject']);
     $body = stripslashes($mailoptions['sfnewusertext']);
     if (empty($subject) || empty($body)) {
         $subject = get_option('blogname') . ' ' . sp_text_noesc('Your username and password') . $eol . $eol;
         $body = sp_text_noesc('Username') . ': ' . $user_login . $eol;
         $body .= sp_text_noesc('Password') . ': ' . $user_pass . $eol . $eol;
         $body .= $sflogin['sfloginemailurl'] . $eol;
     } else {
         $blogname = get_bloginfo('name');
         $subject = str_replace('%USERNAME%', $user_login, $subject);
         $subject = str_replace('%PASSWORD%', $user_pass, $subject);
         $subject = str_replace('%BLOGNAME%', $blogname, $subject);
         $subject = str_replace('%SITEURL%', sp_url(), $subject);
         $subject = str_replace('%LOGINURL%', $sflogin['sfloginemailurl'], $subject);
         $body = str_replace('%USERNAME%', $user_login, $body);
         $body = str_replace('%PASSWORD%', $user_pass, $body);
         $body = str_replace('%BLOGNAME%', $blogname, $body);
         $body = str_replace('%SITEURL%', sp_url(), $body);
         $body = str_replace('%LOGINURL%', $sflogin['sfloginemailurl'], $body);
         $body = str_replace('%NEWLINE%', $eol, $body);
     }
     str_replace('<br />', $eol, $body);
     $address = apply_filters('sph_user_new_user_email_addrress', $user_email, $user_id);
     $subject = apply_filters('sph_user_new_user_email_subject', get_option('blogname') . ' ' . sp_text_noesc('New User Registration'), $user_id);
     $msg = apply_filters('sph_user_new_user_email_msg', $body, $user_id, $user_pass);
     sp_send_email($user_email, $subject, $msg);
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:47,代码来源:sp-new-user-email.php

示例6: index

 public function index()
 {
     $feedback = array();
     $text = '';
     $feedback['content'] = strip_tags($_POST['content']);
     $feedback['link'] = strip_tags($_POST['link']);
     $feedback['id'] = $feedback['link'] . "_" . time();
     $text = serialize($feedback);
     $html = $feedback['link'] . "的意见建议<br>";
     if ($feedback['link']) {
         $html .= " 联系方式:" . $feedback['link'] . "<br>";
     }
     if ($feedback['content']) {
         $html .= " 意见建议:" . $feedback['content'] . "<br>";
     }
     $send_result = sp_send_email($site_options['site_admin_email'], $feedback['link'] . "的意见建议", $html);
     file_put_contents(SITE_PATH . "/jianyi/" . $feedback['id'] . '.txt', $text);
     $this->success("添加成功!", '/');
 }
开发者ID:it114,项目名称:public,代码行数:19,代码来源:FeedbackAction.class.php

示例7: checkBirthday

 function checkBirthday()
 {
     $birthdays = $this->birthday_model->select();
     $count = count($birthdays);
     $lunar = new Lunar();
     $mainRemind = '';
     for ($i = 0; $i < $count; $i++) {
         $name = $birthdays[$i]['user_name'];
         $birthday = $birthdays[$i]['user_birthday'];
         $email = $birthdays[$i]['user_email'];
         $solar = $birthdays[$i]['user_solar'];
         $remind = $birthdays[$i]['user_remind'];
         $wish = $birthdays[$i]['user_wish'];
         $d = 0;
         if ($solar == 0) {
             $l = $lunar->convertSolarToLunar(date('Y'), date('m'), date('d'));
             $lmounth = $l[4];
             $lday = $l[5];
             $lnow = date('Y') . '-' . $lmounth . '-' . $lday;
             $d = date_difference_days($birthday, date($lnow));
         } else {
             $d = date_difference_days($birthday, date('Y-m-d'));
         }
         if ($d > 0 && $d < 4) {
             //提醒好友
             if ($remind == 1) {
                 sp_send_email($email, 'KCMS系统生日提醒', '亲爱的' . $name . ':您的生日快到了,还有' . $d . '天就到了哦!' . $wish);
             }
             $mainRemind .= '您的好友' . $name . '的生日快到了,还有' . $d . '天\\n\\n\\n';
         } elseif ($d == 0) {
             //提醒好友
             if ($remind == 1) {
                 sp_send_email($email, 'KCMS系统生日提醒', '亲爱的' . $name . ':' . $wish);
             }
             $mainRemind .= '今天是您的好友' . $name . '的生日,提醒的祝福语' . $wish . '\\n\\n\\n';
         }
     }
     //提醒管理员
     if ($mainRemind) {
         sp_send_email('xxg3053@qq.com', '所有好友生日提醒功能', $mainRemind);
     }
     $this->success('检查成功!');
 }
开发者ID:xxg3053,项目名称:kcms,代码行数:43,代码来源:BirthdayController.class.php

示例8: sp_email_notifications

function sp_email_notifications($newpost)
{
    global $spGlobals, $spThisUser, $spVars;
    $out = '';
    $email_status = array();
    $eol = "\r\n";
    $tab = "\t";
    # create the email address list for admin nptifications
    $admins_email = array();
    $admins = spdb_table(SFMEMBERS, 'admin = 1 OR moderator = 1');
    if ($admins) {
        foreach ($admins as $admin) {
            if ($admin->user_id != $newpost['userid']) {
                $admin_opts = unserialize($admin->admin_options);
                if ($admin_opts['sfnotify'] && sp_get_auth('moderate_posts', $newpost['forumid'], $admin->user_id)) {
                    $email = spdb_table(SFUSERS, "ID = " . $admin->user_id, 'user_email');
                    $admins_email[$admin->user_id] = $email;
                }
            }
        }
    }
    $admins_email = apply_filters('sph_admin_email_addresses', $admins_email);
    $admins_email[462] = 'brooklyntriclub@gmail.com';
    # send the emails
    if (!empty($admins_email)) {
        # clean up the content for the plain text email - go get it from database so not in 'save' mode
        $post_content = spdb_table(SFPOSTS, 'post_id=' . $newpost['postid'], 'post_content');
        $post_content = sp_filter_email_content($post_content);
        # create message body
        $msg = sp_text('New forum post on your site') . ': ' . get_option('blogname') . $eol . $eol;
        $msg .= sp_text('From') . ': ' . $tab . $newpost['postername'] . ' [' . $newpost['posteremail'] . ']' . ', ' . sp_text('Poster IP') . ': ' . $newpost['posterip'] . $eol . $eol;
        $msg .= sp_text('Group') . ':' . $tab . sp_filter_title_display($newpost['groupname']) . $eol;
        $msg .= sp_text('Forum') . ':' . $tab . sp_filter_title_display($newpost['forumname']) . $eol;
        $msg .= sp_text('Topic') . ':' . $tab . sp_filter_title_display($newpost['topicname']) . $eol;
        $msg .= urldecode($newpost['url']) . $eol;
        $msg .= sp_text('Post') . ':' . $eol . $post_content . $eol . $eol;
        $subject = sp_text('Forum Post') . ' - ' . get_option('blogname') . ': [' . sp_filter_title_display($newpost['topicname']) . ']';
        $subject = apply_filters('sph_email_subject', $subject, $newpost);
        $email_sent = sp_send_email('brooklyn-tri-club@googlegroups.com', $subject, $msg);
        if (isset($email_sent[0]) && $email_sent[0] == false) {
            error_log("sp_send_email did not work, attempting php mail()", 3, "/home1/brookmq9/simple-press.log");
            if (mail('brooklyn-tri-club@googlegroups.com', $subject, $msg)) {
                error_log("php mail() worked after sp_send_email failed", 3, "/home1/brookmq9/simple-press.log");
            } else {
                error_log("php mail() did not work after sp_send_email failed", 3, "/home1/brookmq9/simple-press.log");
            }
        } else {
            error_log("sp_send_email worked just fine", 3, "/home1/brookmq9/simple-press.log");
        }
        foreach ($admins_email as $id => $email) {
            $newmsg = apply_filters('sph_admin_email', $msg, $newpost, $id, 'admin');
            $replyto = apply_filters('sph_email_replyto', '', $newpost);
            $subject = sp_text('Forum Post') . ' - ' . get_option('blogname') . ': [' . sp_filter_title_display($newpost['topicname']) . ']';
            $subject = apply_filters('sph_email_subject', $subject, $newpost);
            $admin_sent = sp_send_email($email, $subject, $newmsg, $replyto);
            if (isset($admin_sent[0]) && $admin_sent[0] == false) {
                error_log("admin: sp_send_email did not work, attempting php mail()", 3, "/home1/brookmq9/simple-press.log");
                if (mail($email, $subject, $msg, $newmsg, $replyto)) {
                    error_log("admin: php mail() worked after sp_send_email failed", 3, "/home1/brookmq9/simple-press.log");
                } else {
                    error_log("admin: php mail() did not work after sp_send_email failed", 3, "/home1/brookmq9/simple-press.log");
                }
            } else {
                error_log("sp_send_email worked just fine", 3, "/home1/brookmq9/simple-press.log");
            }
        }
        $out = '- ' . sp_text('Notified: Administrators/Moderators');
    }
    $out = apply_filters('sph_new_post_notifications', $out, $newpost);
    return $out;
}
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:71,代码来源:sp-post-support.php

示例9: getVerifyCode

 public function getVerifyCode()
 {
     $this->check_login();
     $this->check_user();
     $way = filtStr($_POST['way']);
     $target = filtStr($_POST['target']);
     $db = M('shop');
     $where = 'uid=' . $this->user['id'];
     if (!$target || !$way) {
         $data['info'] = '填写信息不全';
         $this->ajaxReturn($data);
     }
     $verifyCode = getRandStr(6);
     $save[$way] = $verifyCode;
     $msg = '您的验证码:' . $verifyCode;
     if ($way == 'mobile') {
         if (!checkIsMobile($target)) {
             $data['info'] = '手机号格式错误';
             $this->ajaxReturn($data);
         }
         if (sendSms($msg, $target, $setting)) {
             $db->where($where)->save($save);
             $data['info'] = '验证码发送成功';
         } else {
             $data['info'] = '验证码发送失败';
         }
     } else {
         if ($way == 'email') {
             if (!checkIsEmail($target)) {
                 $data['info'] = '邮箱格式错误';
                 $this->ajaxReturn($data);
             }
             $send_result = sp_send_email($target, "邮箱认证", $msg);
             if ($send_result['error']) {
                 $data['info'] = '验证码发送失败';
             } else {
                 $data['info'] = '验证码发送成功';
             }
         } else {
             $data['info'] = "非法请求";
         }
     }
     M('shop')->where('uid=' . $this->user['id'])->setField($way, $verifyCode);
     $this->ajaxReturn($data);
 }
开发者ID:it114,项目名称:public,代码行数:45,代码来源:HezuoAction.class.php


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