请帮助我。我坚持了1个月,没有得到任何解决方案。 我使用以下代码。
Process
在这里,我已经关闭了“减少安全应用访问权限”选项。在这里,我想从同一封电子邮件中发送一封电子邮件(仅供测试之用)。但是代码出现了一些我不理解的错误。……
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require 'includes/PHPMailer.php';
require 'includes/SMTP.php';
require 'includes/Exception.php';
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->HOST = "smtp.gmail.com";
$mail->SMTPAuth = "true";
$mail->SMTPSecure = "tls";
$mail->Port = "587";
$mail->Username = "Myemail";
$mail->Password = "My email password";
$mail->Subject = "Test Email";
$mail->setFrom("My email");
$mail->addReplyTo('My email');
$mail->Body = "This is plain text";
$mail->addAddress("My email");
if ($mail->Send() ) {
echo "Sent";
}else{
echo "ERROR";
}
$mail->smtpClose();
?>
请帮助我。