php - PHPMailer:没有错误但不在实时服务器上发送邮件(php)
问题描述
我正在使用这段代码:
<?php
require ('PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer;
//$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'allthingsremainhere@gmail.com';
$mail->Password = 'password';
$mail->SMTPSecure = 'ssl';
$mail->Port = '465';
$mail->SetFrom('youcanreply@lishup.com', 'Reply It! - LishUp');
$mail->AddAddress('techgoeshere@gmail.com', 'Tech');
$mail->Subject = 'First PHPMailer Message';
$mail->Body = 'Hi! This is my first e-mail sent through PHPMailer.';
if(!$mail->send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>
我的电子邮件和密码没问题。那不是问题。stmp 连接有问题。在 Google 帐户中:2Factor 授权已关闭并且“允许安全性较低的应用”已打开
我正在使用托管在 Google Cloud 上的 Live Server。请帮我解决这个问题
解决方案
推荐阅读
- python - 根据 Pandas 中的其他信息更改数据框中列的一部分
- excel - 根据单元格值添加行
- multithreading - Spring Batch Itemreader 将相同的对象两次传递给 Itemprocessor
- javascript - 从 JSON 数组中删除字段
- android - 如何通过android studio中的多个按钮为两个textview输入文本?
- r - 在绘图标题中使用数据框变量名称
- java - 埃拉托色尼筛(使用 LINKEDLIST)
- sql - Teradata:使用通配符搜索项目的最佳方式
- java - 找不到源Java
- python - Python - AttributeError:'dict'对象没有属性'replace'