0

私は現在単純なフォームに取り組んでおり、情報を php スクリプトで収集してからメールとして送信したいのですが、特定のメールを受信して​​いません。

誰かが指摘したり、問題を強調したりできますか? ありがとうございました

私のフォームのコードは次のとおりです。

<form name="bookingForm" method="post" action="send_dates.php">
<table border="0" cellspacing="1" cellpadding="2">

<tr>
    <td>Booking From</td>
        <td>:</td>
    <td><input name="fromDate" id="fromDate" size="20"></td>

    <td>To</td>
    <td>:</td>
    <td><input name="toDate" id="toDate" size="20"></td>
</tr>

<tr>
    <td>Name</td>
    <td>:</td>
    <td><input name="name" type="text" id="name" size="30"></td>
</tr>

<tr>
    <td width="20px">Telephone</td>
    <td>:</td>
    <td><input name="telephone" type="text" id="customer_telephone" size="30"></td>
</tr>

<tr>
    <td width="20px">Email</td>
    <td>:</td>
    <td><input name="customer_mail" type="text" id="customer_mail" size="30"></td>
</tr>

<tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td><input type="submit" name="submit" value="Submit"> <input type="reset" name="ResetForm" value="Reset"></td>
</tr>
</table>
</form>

そして、ここに私のphpスクリプトがあります:

<?php 

 $name = $_POST['name'];
 $fromDate = $_POST['fromDate'];
 $toDate = $_POST['toDate');
 $email = $_POST['customer_email'];
 $telephone = $_POST['customer_telephone'];

// Mail of reciever
$to = "blablabla@blabla.com";

// Contact subject
$subject ="Reservation Enquiry from $name";

// Details
$message="From: $name
Email: $email
Telephone: $customer_telephone
--------------------------------------------------------------
Reservation date from: $fromDate to: $toDate ";

// Mail of sender
$mail_from="$customer_mail";

// From

$res=mail($to,$subject,$message);
    if($res)
{
    header('Location:index.php');
}

    ?>
4

2 に答える 2

1

セミコロンがありません

$to = "blablabla@blabla.com";

アップデート:

if(!empty($data))ループを削除

チェック$res = mail(...);

次に入れます

if($res)
         {
            echo '<script type="text/javascript">
                     window.location = "index.php";
                  </script>';
         }
         else
         {
             echo 'something wrong';
         }
于 2012-07-26T10:26:53.863 に答える
1

考えられる原因は、間違った SMTP サーバー アドレスです。

Web サーバーを停止し、PHP.INI で SMTP サーバーのアドレスを修正し、Web サーバーを再起動します。

<?php phpinfo(); ?>および を実行して SMTP を検索すると、現在の構成を確認できます。

于 2012-07-26T10:29:01.207 に答える