Not receiving email on Gmail using Gmail SMTP but receiving on web server using my server SMTP
I am trying to send contact form to my gmail when user submit the form, but I have not receiving any email on Gmail when I am using Gmail SMTP server, I am trying both tls with port 587 & ssl with port 465.
But when I used my server SMTP it's working properly and I also received email on my web server. Code is working on PLESK but not working on Cpanel. Code is here:
IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->Username = "**@gmail.com";
$mail->Password = "**";
$mail->Host = "smtp.gmail.com";
$mail->Mailer = "smtp";
$mail->SetFrom($_POST["userEmail">, $_POST["userName">);
$mail->AddReplyTo($_POST["userEmail">, $_POST["userName">);
$mail->AddAddress("**@gmail.com");
$mail->Subject = "Website Contact Us Form Email";
$mail->WordWrap = 80;
$mail->Body = "User Name: ".$_POST["name">."
"."User Phone Number: ".$_POST["phone">."
"."User Email: ".$_POST["email">."
"."User Message: ".$_POST["message">."
"; if(is_array($_FILES)) { $mail->AddAttachment($_FILES['attachmentFile'>['tmp_name'>,$_FILES['attachmentFile'>['name'>); } $mail->IsHTML(true); if(!$mail->Send()) { echo "
"."User Phone Number: ".$_POST["phone">."
"."User Email: ".$_POST["email">."
"."User Message: ".$_POST["message">."
"; if(is_array($_FILES)) { $mail->AddAttachment($_FILES['attachmentFile'>['tmp_name'>,$_FILES['attachmentFile'>['name'>); } $mail->IsHTML(true); if(!$mail->Send()) { echo "
Problem in Sending Mail.
"; } else { echo "Contact Mail Sent.
"; } ?>-
What is the error you're receiving? What is output when you enable SMTP Debug? 0 -
What is the error you're receiving? What is output when you enable SMTP Debug?
No Error on Web form submit successfully on Gmail i am receiving Sign in attempt was block email.0 -
No Error on Web form submit successfully on Gmail i am receiving Sign in attempt was block email.
If there was an error with sending the email, you should have a corresponding error on the server, it wouldn't necessarily be present on the web form but if you have the script setup to debug it should output this information. The page for the PHP mailer goes into some troubleshooting steps which would be useful for you PHPMailer/PHPMailer0
Please sign in to leave a comment.
Comments
3 comments