I used the following code in my app to send a mail from my heroku app
<?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.';
}
?>
But, my app is showing up "Message was not sent.Mailer error: The following From address failed: suneetha.itham@gmail.com : MAIL FROM command failed,530,5.7.0 Must issue a STARTTLS command first. h20sm18987465qen.5 - gsmtp" \\n Can any one help me to solve this problem.Thanks.
I think this more a issue with your smtp config's See this answer: https://stackoverflow.com/a/16048485/959041
Does your code work on your local machine?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.