有人可以告訴我如何解決此腳本,以便表單信息發送到正確的電子郵件(即,我的電子郵件....讓我們假設我的電子郵件是[email protected]) 。我希望電子郵件能夠顯示發送給我的用戶的電子郵件地址。從腳本發送電子郵件的PHP腳本
<?php
$name = $_POST['fldName'];
$email = $_POST['fldEmail'];
$phone = $_POST['fldPhone'];
$comments = $_POST['fldComments'];
$isFormValid = false;
if (strlen($name) && strlen($email) && strlen($phone) && strlen($comments)) $isFormValid = true;
if ($isFormValid)
{
$to = '[email protected]';
$subject = 'Contact Us Form Comments';
$message = 'Name: '.$name."\r\n".'Email: '.$email."\r\n".'Comments: '.$comments;
$headers = 'From: [email protected]' . "\r\n"
. 'Reply-To: [email protected]' . "\r\n";
mail($to, $subject, $message, $headers);
header("location: thankyou.html");
}
else
{
echo "Please fill in the required fields";
}
?>
是否有錯誤? – 2012-07-25 23:03:10