phpmailer发送但不接收
phpmailer sending but not receiving
刚刚完成设置 PHPMailer 以发送从我的 html 表单创建的 PDF(使用 FPDF,创建 pdf 文件没有问题)。显示发送成功但我没有收到任何东西?
我检查了其他人的代码,它看起来和我的一样。底部的 PHPmailer 代码有什么问题吗?
据我所知,我的主机、用户名和密码都是 100% 正确的,我们不使用 TLS 或 SSL。也许这与此有关?
我的代码:
require 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 4;
$mail->Host ="*****";
$Mail->SMTPAuth = true; // enable SMTP authentication;
$mail->Username = "*****";
$mail->Password = "****";
$mail->Port = 587;
$mail->SMTPSecure = "tls";
$mail->From = "******";
$mail->FromName = "Jurgen Hof";
$mail->addAddress("testingaccount23@gmail.com", "Tester");
$mail->isHTML(true);
$mail->Subject = 'Test Leave Application';
$mail->Body = 'Test.';
$mail->AddAttachment("/var/www/html/leaveform/AlpineLeaveApplication.pdf");
if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Email Sent Successfully!';
?>
您正在设置很多 SMTP 属性,但实际上并没有要求它通过 SMTP 发送!添加:
$mail->isSMTP();
然后您的浏览器会出现调试输出,所以我建议您关闭 SMTPDebug = 2
。
刚刚完成设置 PHPMailer 以发送从我的 html 表单创建的 PDF(使用 FPDF,创建 pdf 文件没有问题)。显示发送成功但我没有收到任何东西?
我检查了其他人的代码,它看起来和我的一样。底部的 PHPmailer 代码有什么问题吗?
据我所知,我的主机、用户名和密码都是 100% 正确的,我们不使用 TLS 或 SSL。也许这与此有关?
我的代码:
require 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 4;
$mail->Host ="*****";
$Mail->SMTPAuth = true; // enable SMTP authentication;
$mail->Username = "*****";
$mail->Password = "****";
$mail->Port = 587;
$mail->SMTPSecure = "tls";
$mail->From = "******";
$mail->FromName = "Jurgen Hof";
$mail->addAddress("testingaccount23@gmail.com", "Tester");
$mail->isHTML(true);
$mail->Subject = 'Test Leave Application';
$mail->Body = 'Test.';
$mail->AddAttachment("/var/www/html/leaveform/AlpineLeaveApplication.pdf");
if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Email Sent Successfully!';
?>
您正在设置很多 SMTP 属性,但实际上并没有要求它通过 SMTP 发送!添加:
$mail->isSMTP();
然后您的浏览器会出现调试输出,所以我建议您关闭 SMTPDebug = 2
。