需要电子邮件脚本更正建议

时间:2015-09-29 07:58:17

标签: php json email-integration

任何人都可以建议在这几行代码中进行更正。我非常不安,因为它没有工作和时间流逝。请帮我纠正或建议一个新的。

<?php
$email_to = 'info@khawabnama.com';
$subject = "Contact US";   
$name =$_POST['flname']; 
$email_from = $_POST['email']; 
$message = $_POST['message']; 
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
 'X-Mailer: PHP/' . phpversion();
 $body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n"    .     'Subject: ' . $subject . "\n\n" . 'Message: ' . $message;

 $success=@mail($email_to, $subject, $body, $headers);  

 header('Content-type: application/json');
 $status = array(
    'type'=>'success',
    'message'=>'Email sent!'
  );
  //    $success = @mail($email_to, $subject, $body, 'From:      <'.$email_from.'>');
echo json_encode($status);
//header("Location: index.php");

//header('Location: http://www.khawabnama.com/index.php');
//die; 

0 个答案:

没有答案