0
當我將電子郵件更改爲我的個人hotmail地址時,該消息就會出現 - 儘管它位於我的垃圾郵件文件夾中。但是,當我將此更改爲客戶的電子郵件時,該消息根本沒有變動。有人知道我能如何解決這個問題嗎?爲什麼聯繫表單不發送電子郵件給客戶?
這是該表單的PHP:
<?php
if(isset($_POST['submit'])) {
$name = $_POST['name'];
$address = $_POST['address'];
$number = $_POST['number'];
$email = $_POST['email'];
$message = $_POST['message'];
$subject = 'Message from Reef Cleaning solutions website';
$to = '[email protected]';
if (empty($name) || empty($address) || empty($number) || empty($email) || empty($subject) || empty($message)) {
if (empty($name))
$error['name'] = "Please enter your Full Name";
if (empty($address))
$error['address'] = "Please enter your address";
if (empty($number))
$error['number'] = "Please enter a contact number";
if (empty($email))
$error['email'] = "Please enter a valid Email Address";
if (empty($message))
$error['message'] = "Please write a message, enquiries or other concerns above";
}
else { //if not empty
$body = "
Name: $name\r\n
Address: $address\r\n
Number: $number\r\n
Email: $email\r\n
Message: $message
";
$headers="From: {$email}\r\nReply-To: {$email}"; //create headers for email
if(mail($to,$subject,$body,$headers))
{
$success = "mail has been sent";
}
else
{
echo "error during sending mail";
}
}
}
?>
這是HTML
<form method="POST">
<table border="1">
<tr>
<td><label for="name" class="g">Name</label></td>
<td><input id="name" name="name" type="text" autofocus required /></td>
</tr>
<tr>
<td><label for="address" class="g">Address</label></td>
<td><textarea rows="3" id="address" name="address" cols="50"></textarea></td>
</tr>
<tr>
<td><label for="number" class="g">Contact number</label></td>
<td><input id="number" name="number" type="text" autofocus required /></td>
</tr>
<tr>
<td><label for="email" class="g">Email</label></td>
<td><input id="email" name="email" type="text" placeholder="[email protected]" autofocus required /></td>
</tr>
<tr>
<td><label for="message" class="g">Enquiry</label></td>
<td><textarea rows="3" id="message" name="message" required cols="50"></textarea></td>
</tr>
</table>
<input type="submit" value="Submit" name="submit" />
<div id="message-sent">
<?php
if ($success) {
echo $success;
}
?>
</div>
</form>
如果它出現在垃圾郵件文件夾中,它將被髮送;因此它的問題客戶端 – Ryan 2013-05-10 12:11:57
我想他是說如果他發送電子郵件到一個hotmail帳戶的電子郵件發送和進入垃圾郵件文件夾在Hotmail。如果他將電子郵件發送到[email protected],則不會發送電子郵件。但是..你有什麼錯誤嗎?我的意思是,電子郵件被您的客戶發送和拒絕,或郵件根本不發送?你至少能夠檢測到? HTML表單很好,即使代碼看起來不錯。 – Madthew 2013-05-10 12:14:40
我正在使用outitgoes.com測試客戶端電子郵件地址,並且此收件箱或垃圾郵件文件夾中未顯示任何內容。 但是,當我在我的個人hotmail上測試它時,它確實出現在我的電子郵件中。 – 2013-05-10 12:17:04