0
<?php
include_once('include/connection.php');
if(isset($_POST['submit']))
{
$name=mysql_real_escape_string($_POST['name']);
$contact=mysql_real_escape_string($_POST['contact']);
$email=mysql_real_escape_string($_POST['email']);
$comments=mysql_real_escape_string($_POST['comments']);
/*
echo var_dump($name);
echo var_dump($contact);
echo var_dump($email);
echo var_dump($comments);
*/
$fdate=date("d/m/Y");
$date = date("m/d/Y h:i:s a");
//echo date("m/d/Y h:i:s a", time());
$query = "INSERT INTO `form_entry`(`name`, `contact`, `email`, `comments`)
VALUES ('$name', '$contact', '$email', '$comments')";
//echo var_dump($query);
mysql_query($query) or die ('Error updating database: '.mysql_error());
//SEND CONFIRMATION EMAIL
require_once('mailer/class.phpmailer.php');
$message= "
<br /><br />
-------------------------------------------------------------------------------------------------
-- Name : $name <br>
-- Contact : $contact <br>
-- Email ID : $email <br>
-- Comments : $comments <br>
------------------------------------------------------------------------ -------------------------
";
$subject = "Enquiry from $name";
$mail = new PHPMailer();
$mail->IsSMTP();
//$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username="[email protected]";
$mail->Password="[email protected]@!";
$mail->SetFrom('[email protected]','xyz ');
$mail->FromName="xyz";
$mail->AddAddress($email);
$mail->AddReplyTo("[email protected]","xyz ");
$mail->Subject = $subject;
$mail->Body = "Hello Sir/Madam,";
$mail->IsHTML($message);
$mail->Send();
echo "<script>alert('Data Saved Successfully');</script>";
mysql_close($connection);
}
?>
輸出:「SMTP錯誤:無法驗證」 這是我嘗試的gmail身份驗證。 ID &用於驗證的密碼無疑是完美的。 檢查來自Google的SMTP服務器設置,看起來一樣。 我查了其他帖子,但沒有解決我的問題。 請幫助一樣!提前致謝!SMTP:無法驗證
你基於一個過時的例子代碼,您使用的是舊版本的PHPMailer的,你沒有看過的文檔,或者是什麼的重複這個問題說。 – Synchro