<?php
if(isset($_POST['submit']))
{
$data=$_POST;
var_dump($data);
//require "PHPMailer/class.phpmailer.php";
require_once("PHPMailer/class.phpmailer.php");
$message = '<html><body>';
$message .= '<table rules="all" style="border-color: #666; width:100%;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td style=\"width:150px;\"><strong>Car:</strong> </td><td>" . strip_tags($_POST['available_car']) . "</td></tr><br>";
$message .= "<tr><td><strong>Rate:</strong> </td><td>" . strip_tags($_POST['rate']) . "</td></tr>";
$message .= "<tr><td><strong>Pickup Address:</strong> </td><td>" . strip_tags($_POST['pickup_address']) . "</td></tr>";
$message .= "<tr><td><strong>Time:</strong> </td><td>" . strip_tags($_POST['pickup_date']) . "</td></tr>";
$message .= "<tr><td><strong>Full Name:</strong> </td><td>" . strip_tags($_POST['full_name']) . "</td></tr>";
$message .= "<tr><td><strong>Phone Number:</strong> </td><td>" . strip_tags($_POST['phone']) . "</td></tr>";
$message .= "<tr><td><strong>Comment:</strong> </td><td>" . strip_tags($_POST['comment']) . "</td></tr>";
$message .= "</table>";
$message .= "</body></html>";
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "localhost"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "example@multipoint.com"; // SMTP username
$mail->Password = "example"; // SMTP password
$mail->From = "example@multipoint.com";
$mail->FromName = "name";
$mail->AddAddress("example@multipoint.com"); // name is optional
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = "Here is the subject";
//$mail->MsgHTML($message);
$mail->Body = "$message";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
}
?>
我的另一台服务器上的代码相同。但它不适用于特定的服务器。它给出了错误SMTP connect()
失败。我看了以前的问题有相同的错误,但我找不到我的解决方案。
这是服务器问题吗?如果那么什么类型的问题?我怎么解决呢?提前谢谢