Tôi đang sử dụng webmail 000webhost để nhận email bằng biểu mẫu liên hệ nhưng không hoạt động.Không thể gửi thư trong biểu mẫu liên hệ PHP bằng cách sử dụng 000webhost webmail
contact.php
<form action="mailer.php" method="post">
<p>Name:</p>
<input type="text" name="name" />
<p>E-mail:</p>
<input type="text" name="email" />
<p>Subject:</p>
<input type="text" name="subject" />
<p>Message:</p>
<textarea name="message"></textarea></p>
<input class="send" type="submit" value="Send" name="submit">
</form>
mailer.php
<?php
$to = "[email protected]";
$subject = "Support requested by ".$_POST['name'];
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$headers = 'From: '.$_POST['email'].'' . "\r\n" .
'Reply-To: '.$_POST['email'].'' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$body = $message;
@mail($to, $subject, $body, $headers);
header('Location:thankyou.php') ; //replace with landing page.
?>
Wh một phần không hoạt động? Tin nhắn không được gửi? Bạn đang nhận được thông báo lỗi? Bạn đã kiểm tra nhật ký của mình chưa? – brbcoding
Đầu tiên và trước hết, hãy xóa "@" khỏi "@mail" để bạn sẽ thấy lỗi nếu có. –
tôi thấy trang cảm ơn nhưng tôi không nhận được email nào – Mercury121