2 回答

TA貢獻1827條經驗 獲得超4個贊
這聽起來像是網絡/系統管理員問題,而不是 PHPMailer 問題。試試
telnet smtp.gmail.com 587 // host and port
在您的控制臺中,用于檢查連通性。如果一切正常,它應該寫一條消息,如“ESMTP MAIL 服務就緒”。否則,該服務器會阻止您的服務器。

TA貢獻1785條經驗 獲得超8個贊
請在您的文件中添加類 smtp 或使用此代碼并相應地更改憑據它將起作用。
include_once('class.phpmailer.php');
require_once('class.smtp.php');
$name = strip_tags($_POST['full_name']);
$email = strip_tags ($_POST['email']);
$msg = strip_tags ($_POST['description']);
$subject = "Contact Form from DigitDevs Website";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = "mail.example.com"; // SMTP server example
//$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 26; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // SMTP account username example
$mail->Password = "password"; // SMTP account password example
$mail->From = $email;
$mail->FromName = $name;
$mail->AddAddress('[email protected]', 'Information');
$mail->AddReplyTo($email, 'Wale');
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $msg;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Message has been sent';
- 2 回答
- 0 關注
- 129 瀏覽
添加回答
舉報