コード例 #1
0
 public function sendFeedback()
 {
     if (isset($_POST['id'])) {
         $id = $_POST['id'];
         $address = $_POST['email'];
         $fromName = session("adminname");
         $toName = $_POST['author'];
         $subject = "答复反馈问题";
         $body = $_POST['reply'];
         if (sendMail1($address, $fromName, $toName, $subject, $body)) {
             if ($this->updateContact($id, $_POST['reply']) === false) {
                 exit("操作数据库失败。");
             }
             echo "邮件发送成功";
         } else {
             echo "邮件发送失败,请检查邮箱设置及网络情况。";
         }
     } else {
         exit("非法操作!");
     }
 }
コード例 #2
0
<?php

require_once 'config.php';
require_once 'emailer/class.phpmailer.php';
require_once 'mailFunction.php';
$arr = array();
$email = '';
$subject = "Password Info";
if (isset($_POST['email'])) {
    $email = $_POST['email'];
    $sql = "SELECT * FROM `register` where `email`='" . $email . "'";
    $stmt = $link->query($sql);
    $row = $stmt->rowCount();
    if ($row > 0) {
        while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $name = $rs['username'];
            $password = $rs['password'];
        }
        $to = $email;
        $body = '<p>Dear <b>' . $name . ',</b><br><br>Your Password is:<b>' . $password . '</b></p>';
        sendMail1($subject, $body, $to);
        $arr['code'] = '1';
        $arr['status'] = 'Password has been sent to your EmailId';
    } else {
        $arr['code'] = '0';
        $arr['status'] = 'EmailId does not Exist.';
    }
}
echo json_encode($arr);