我在我的应用程序中使用以下代码从我的 heroku 应用程序发送邮件
<?php
require("PHPMailer-master/class.phpmailer.php");
require("PHPMailer-master/class.smtp.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->From = "suneetha.itham@gmail.com";
$mail->AddAddress("suneetha@yantranet.com");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}else {
echo 'Message has been sent.';
}
?>
但是,我的应用程序显示 “未发送消息。邮件程序错误:以下发件人地址失败:suneetha.itham@gmail.com:MAIL FROM 命令失败,530,5.7.0 必须先发出 STARTTLS 命令。h20sm18987465qen.5 - gsmtp" \n 谁能帮我解决这个问题。谢谢。