【问题标题】:php xampp mail not sent [duplicate]php xampp邮件未发送[重复]
【发布时间】:2014-12-03 01:20:05
【问题描述】:

我正在尝试使用 php 邮件功能实现忘记密码功能。

我正在使用 xampp 和 mac os 10.9.4

我得到response1 并且也没有错误消息。但是邮件没有发送。

以下是代码:

<?php
// error_reporting(E_ALL);
$response = array();
require_once __DIR__.'/db_connect.php';
$db = new DB_CONNECT();
if(isset($_POST['email'])){
    $to = $_POST['email'];
    $subject = "Password recovery";
    $res = mysql_query("select password from userMaster where email_id = '$to'");
    if($res){
        $pwd="";
        while($row=mysql_fetch_array($res)){
            $pwd = $row['password'];
            // echo $pwd." ".$to;
        }
        $result = mail($to, $subject,$pwd);
        echo $result; die;
        if($result){
            $response["success"]=1;
            $response["message"]="Mail sent successfully";
        } else {
            print_r(error_get_last()); echo $result; die;
        }
    }else {
        $response["success"] = 0;
        $response["message"] = "Error sending mail";
        //echo mysql_error(); die;
    }
}else {
    $response["success"] = 0;
    $response["message"] = "Missing parameters";
}
echo json_encode($response);
?>

我在谷歌上搜索并找到了许多解决方案,但没有一个对我有利。 我哪里错了?我该如何解决?

【问题讨论】:

    标签: php ios email xampp


    【解决方案1】:

    它不适用于 localhost。在免费的托管网站上试用它,它会起作用。

    【讨论】:

      猜你喜欢
      • 2015-07-28
      • 2012-12-15
      • 2015-01-05
      • 2013-02-15
      • 1970-01-01
      • 2013-01-31
      • 1970-01-01
      • 1970-01-01
      • 2016-05-13
      相关资源
      最近更新 更多