我正在尝试显示调试信息,但没有显示在我的html页面上:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'src/Exception.php';
require 'src/PHPMailer.php';
require 'src/SMTP.php';
if(isset($_POST["submit"])){
$username = 'username@gmail.com';
$password = 'MyPass';
$to = $username;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->IsHTML(true);
$mail->Username = $username;
$mail->Password = $password;
$mail->SetFrom($_POST["contactName"." "."contactEmail"]);
$mail->Subject = $_POST["contactSubject"];
$mail->Body = $_POST["contactMessage"];
$mail->AddAddress($to);
if(!$mail->Send())
{
echo "Mailer error : " . $mail->ErrorInfo . "<br>";
}
}
实际上我只得到一个空div,错误div被调用,但没有显示任何内容
看到出现错误,我必须更改什么? 我查看了wiki,我的代码似乎是正确的。