webform邮件错误。邮件发送者的详细信息空白

时间:2016-06-07 12:04:58

标签: php

我从网络表单收到的邮件没有任何发件人的详细信息。我是初学者。有人可以指导我让它工作。这是错误和php和js的屏幕截图。

<?php

    header('Content-type: application/json');

    $status = array(

        'type'=>'success',`enter code here`

        'message'=>'Email sent!'
    );

    $name = @trim(stripslashes($_POST['name']));

    $email = @trim(stripslashes($_POST['email']));

    $subject = @trim(stripslashes($_POST['subject']));

    $message = @trim(stripslashes($_POST['message']));


    $email_from = $email;

    $email_to = 'myname@gmail.com';

    $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Subject: ' 
. $subject . "\n\n" . 'Message: ' . $message;


  $success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');


 echo json_encode($status);

die;
?>

验证

$('.contact-form').submit(function () {'use strict',

$this = $(this);

$.post("sendemail.php", $(".contact-form").serialize(),function(result){

if(result.type == 'success'){

$this.prev().text(result.message).fadeIn().delay(3000).fadeOut();

}

});

return false;

});

0 个答案:

没有答案