我是一名php初學者,我試圖通過使用php mail()函數的電子郵件發送表單數據。出於某種原因,我的表單正在處理並轉到感謝頁面,但我沒有收到包含數據的電子郵件。 我檢查了我的代碼,但無法找到問題所在!有人能請我幫忙嗎? 這裏是我的代碼示例:通過腳本發送的電子郵件未送達
<form class="form-wrapper" action="process_form.php" method="post">
<label for="costumer_name">First Name</label><br/>
<input type="text" name="costumer_first_name"/>
<button type="submit">Send</button>
</form>
這是process_form.php代碼
<?php
$CustomerFirstName = $_POST['customer_first_name'];
// Build the email
$to = "[email protected]";
$headers = "From: $Email";
$subject = "Red T-shirt Web Order";
$message = "Red T-shirt Order Information:\n\n
Customer First Name:".$CustomerFirstName."\n";
// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);
// Redirect
header("Location: thank_you.php");
?>
謝謝:)
windows,linux? – Neal 2011-04-18 15:16:54
它是一個Windows服務器或Linux服務器? – kjy112 2011-04-18 15:17:04
也在這一行'$ headers =「From:$ Email」;'創建'$ Email' – Neal 2011-04-18 15:17:29