0

php、html、cssを使ってコードを書きました。これは、送信後に電子メールで受信される連絡フォームです。送信中にエラーはありませんが、メールが届きません。ここにコードを含めます。これはリンクです: http://complaintdesk.byethost15.com/contact.php。また、ここにコードを含めます。

contact.php

<?php
if(isset($_POST['submit'])){
    $name = $_POST['fullname'];
    $branch = $_POST['branch'];
    $usn = $_POST['usn'];
    $sem = $_POST['sem'];
    $email = $_POST['email'];
    $subject = $_POST['subject'];
    $description = $_POST['comment'];

    $to = 'email@example.com';

    $display = 'From:</br>Name: $name</br>USN: $usn</br>Branch: $branch</br>Semester: $sem</br>Email: $email</br></br>$description';
    mail($to,$subject,$display);
    echo "<script>alert('Your Complaint has been succesfully submitted, We will contact you soon.')</script>";
};

?>

そして、私が含めていない残りのコード...

4

1 に答える 1

0

これを試して:

$to_address = "Your email address";
$subject = $_POST['subject'];
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.= "From: ".$email."\r\n";

if (mail($to_address,$subject,$description,$headers)){
    echo "Success";
}
else{
    echo "<h2>Unable to submit the form, please recheck the details.</h2>" ;
 }

更新: これが機能しない場合は、電子メールの構成にエラーがある可能性があります。上記のコメントで他のユーザーが示唆しているように、その部分も調べてください。この回答は、メール サーバー/PHP が正しく構成されているという前提に基づいています。

于 2013-07-22T17:24:29.153 に答える