试图通过电子邮件发送查询信息与php邮件,当我是gmail设置它工作正常但现在我用我的域电子邮件帐户更改它并尝试使用ssl / tls或没有ssl的配置,其现在不工作了,
收到类似的错误消息。
2015-02-05 10:29:08 CLIENT -> SERVER: EHLO localhost
2015-02-05 10:29:09 CLIENT -> SERVER: AUTH LOGIN
2015-02-05 10:29:09 CLIENT -> SERVER: [removed]
2015-02-05 10:29:09 CLIENT -> SERVER: [removed]
2015-02-05 10:29:10 CLIENT -> SERVER: MAIL FROM:<>
2015-02-05 10:29:10 CLIENT -> SERVER: RCPT TO:
2015-02-05 10:29:11 CLIENT -> SERVER: DATA
2015-02-05 10:29:11 CLIENT -> SERVER: Date: Thu, 5 Feb 2015 11:29:07 +0100
2015-02-05 10:29:11 CLIENT -> SERVER: To: [removed]@gmail.com
2015-02-05 10:29:11 CLIENT -> SERVER: From: Root User <>
2015-02-05 10:29:11 CLIENT -> SERVER: Subject: Visitor Query
2015-02-05 10:29:11 CLIENT -> SERVER: Message-ID:
2015-02-05 10:29:11 CLIENT -> SERVER: X-Priority: 3
2015-02-05 10:29:11 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.9 (https://github.com/PHPMailer/PHPMailer/)
2015-02-05 10:29:11 CLIENT -> SERVER: MIME-Version: 1.0
2015-02-05 10:29:11 CLIENT -> SERVER: Content-Type: text/html; charset=iso-8859-1
2015-02-05 10:29:11 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2015-02-05 10:29:11 CLIENT -> SERVER:
2015-02-05 10:29:11 CLIENT -> SERVER: Name: [removed]
Email: [removed]@gmail.com
Contact: 434324
Query: dgfdfsd
2015-02-05 10:29:11 CLIENT -> SERVER:
2015-02-05 10:29:11 CLIENT -> SERVER: .
2015-02-05 10:29:12 CLIENT -> SERVER: QUIT
你可以帮我找到错误。
这是我的代码,
<?php
$name = $email = $contact = $query = "";
$message = '';
$error = array();
if ($_SERVER ["REQUEST_METHOD"] == "POST") {
if (empty ( $_POST ["name"] )) {
$error[] = 'Please Enter Your Name';
} else {
$message = 'Name: ' . $_POST["name"] . '<br>';
}
if (empty ( $_POST ["email"] )) {
$error[] = 'Please Enter Your Email Id';
} else {
if (!filter_var ( $_POST['email'], FILTER_VALIDATE_EMAIL )) {
$error[] = "Invalid email format";
} else {
$message .= 'Email: ' . $_POST["email"] . '<br>';
}
}
if(empty($_POST["contact"])){
$error[] = 'Please Enter Your Mobile Number';
} else {
$message .= 'Contact: ' . $_POST["contact"] . '<br>';
}
if (empty ( $_POST ["query"] )) {
$error[] = 'Please type your query';
} else {
$message .= 'Query: ' . $_POST["query"] . '<br>';
}
}
//require_once ("PHPMailer/class.phpmailer.php");
//require_once ("PHPMailer/class.smtp.php");
require_once ("PHPMailer/PHPMailerAutoload.php");
$subject = "Visitor Query";
$from = "info@s2sproject.com"; // example a@b.com
$password = 'mypass';
$mail = new PHPMailer();
$body = $message;
$mail->IsSMTP();
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPDebug = 1;
//$mail->Host = 'mail.s2sproject.com'; // sets SMTP server
$mail->Host = 'p3plcpnl0880.prod.phx3.secureserver.net'; // sets SMTP server
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
//$mail->Port = 25;
$mail->Username = $from; // SMTP username
$mail->Password = $password; // SMTP password
$mail->AddAddress ( "partyushgoyal@gmail.com" );
$mail->Subject = $subject;
$mail->Body = $message;
$mail->From = $email;
$mail->ContentType = "text/html";
if (count($error == 0)) {
$mail->Send();
//echo $result;
} else {
echo $error; // show error messages
//echo $result;
}
//header("location: index.php");
?>