PHP脚本ecexutes但没有接收邮件?

时间:2017-09-13 08:42:07

标签: php jquery html

我想从html表单发送邮件,我已经单独编写了脚本。 以下是我的js代码:

var IUsername       = $("#IUsername").val();
var NEmail          = $("#IEmail").val();
var IMsg            = $("#IMsg").val();


$.ajax({

    url     :"script_mail.php",
    method  :"POST",
    data    :{IUsername:IUsername, NEmail:NEmail, IMsg:IMsg},

    success :function(data){

        if(data == "T"){
            fxn_CLR();
            $('#chars').text('200');
            alert(data);
        }else{
            alert(data);
        }

    }

});

以下是我的PHP代码

if(isset($_POST["IUsername"])){


        $IUsername  = $_POST["IUsername"];
        $from       = $_POST["NEmail"];
        $to         = "partap26@gmail.com";
        $subject    = "Customer Enqury";
        $headers    = "From:" . $from . "\r\n";
        $headers    .= "Reply-To: ".$IUsername. "\r\n"; 
        $headers    .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
        $message    = "Name: ".$IUsername.""; 
        $message    .= "Email: ".$from ."";
        $message    .= "Comment: ".nl2br($_POST["IMsg"]).""; 



    if(mail($to,$subject,$message,$headers)){
        echo "T";
    }else{
        echo "F";
    }

我可以在警报中看到T ...但是无法在上述电子邮件ID中收到任何邮件....

0 个答案:

没有答案