HOME > PHP > PHP Forum > Script Error Warning: mail() [function.mail]: Failed to connect to mailserver at "xxx" port 25, verify your "SMTP" and "smtp_port"
Script Error Warning: mail() [function.mail]: Failed to connect to mailserver at "xxx" port 25, verify your "SMTP" and "smtp_port"
ข้อความ error แบบนี้ครับ ปัญหาอยู่ที่ Code หรือ Server ครับ
Code
Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.netdesignhost.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\webspace\maldivepackage.com\httpdocs\send.php on line 32
Code (PHP)
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<?php
$body = "Resort : $BOOKINGFOR<br>";
$body .= "First Name : $FirstName<br>";
$body .= "Last Name : $LastName<br>";
$body .= "Nationality : $Nationality<br>";
$body .= "City : $City<br>";
$body .= "Country : $Country<br>";
$body .= "Telephone : $Telephone<br>";
$body .= "E-mail: <a href = mailto:$Email>$Email</a><br>";
$body .= "Fax Number : $FaxNumber<br>";
$body .= "Arrival Date : $Dateofarrival $MonthofArrival $YearofArrival<br>";
$body .= "Departure Date : $Dateofdeparture $MonthofDeparture $YearofDeparture<br>";
$body .= "Arrival by : $Airlines<br>";
$body .= "No. of Nights : $TotalNights<br>";
$body .= "No. of Passenger : Adult : $Adult Children :$Children<br>";
$body .= "Passenger Name : $TravellerName<br>";
$body .= "Room Category : $RoomType<br>";
$body .= "Room Type : Single :$SingleRoom Twin :$TwinRoom Double :$DoubleRoom<br>";
$body .= "Special Request : $SpecialRequest<br>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: $email <$Email>\r\n";
$headers .= "X-Priority : 1\r\n";
$headers .= "X-MSMail-Priority: High\n";
$to="[email protected]";
$subject="Contact From Resort : $BOOKINGFOR ";
ini_set("SMTP","smtp.netdesignhost.com");
if (mail($to,$subject,$body,$headers)) {
?>
</BR></BR></BR></BR></BR></BR></BR></BR></BR></BR>
<? echo "<center><br><br>กำลังบันทึกข้อมูล กรุณารอสักครู่.......<br><br><img src='image/ajax-loader-bar.gif'>";
echo"<meta http-equiv='refresh' content='5;URL=thank.html'>";
?>
<?
}
else
{
?>
</BR></BR></BR></BR></BR></BR></BR></BR></BR></BR>
<? echo "<center><br><br>Sorry, Mail service is not available.Please try again later. Page will redirect in 5 second.......<br><br><img src='image/ajax-loader-bar.gif'>";
echo"<meta http-equiv='refresh' content='5;URL=error.html'>";
?>
<?
}
?>