PHP email sent is successful but not receiving in Inbox

Hi there

This is my code that I am using to send email from gmail SMTP server to from my PHP program

 <?php
 require_once("./PHPMailer-master/PHPMailerAutoload.php");
 $mail=new PHPMailer();
 $mail->SMTPDebug=0;
 $mail->SMTPauth=true;
 $mail->SMTPSecure='ssl';
 $mail->Host="smtp.gmail.com";
 $mail->Port=587;
 $mail->IsHTML(true);
 $mail->Username="somevalidfromemail@gmail.com";
 $mail->Password="validpassword";
 $mail->SetFrom("somevalidformemail@gmail.com");
 $mail->Subject="This is My Email subject";
 $mail->Body="This is Body of send email";
 $mail->AddAddress("somevalidemail@gmail.com");
 if(!$mail->Send())
 {
     echo "Mail Error:".$mail->ErrorInfo;
 }
 else
 {
 echo "Message has been sent";
 }
?>

I am getting message printed in output in browser window as

“Message has been sent”

but not email in my send inbox

I have tried these things
1)Opened less secure apps in associated gmail account in form
2)different port 465,587 on windows

where is wrong?

Thanks

Have you tried enabling SMTPDebug?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.