I am not getting any error is sending email via PHPMailer but unable to receive email in my INBOX. The same code works fine on other hosting account. I have read all the FAQ’s Knowledge base and followed the the give step’s but it did not work.
PFB - The PHPMailer code for your reference.
$mail = new PHPMailer;
$mail->Subject='Form Submission: '.$_POST['subject'];
$mail->Body='<h1 align=center>Name:'.$_POST['name'].'<br>Email: '.$_POST['email'].'<br>Message: '.$_POST['msg'].'</h1>';
$result="Something went wrong. please try again.";
$result="Thanks! ".$_POST['name']." For contacting us we will get back soon";
<h1> Thank you for contacting us we willl get back to you soon</h1>
So you’re using one Gmail account to send to that same Gmail account? I believe Gmail filters out those messages and only stores them in the Sent folder.
I would recommend to use a second account for the sending and see if that works.
Also, you’re using the email address filled in by the user as the From address. Most email providers are quite picky with the sending address you provide, and won’t let you send email from an address you don’t control. That’s why our official contact form example uses your own domain as the sender address, not the address enter by the visitor.