1

I'm trying to create a contact form on my website with PHPMailer. The issue is that when I try it on my local server (with Wampserver), the email is sent but when I try it on the hosted server I get the SMTP Error : Could not authenticate. I created a fresh new gmail account to send my emails, I enabled the less-security access and I don't have any sorts of 2-Step authentification.

I use an external php file to create the template of the mail, here is the code : enter image description here

I use the switch to get emails from differents forms, as I would eventually need to send differents types of mail which would require different fields or templates.

KenTay7
  • 111
  • 1
  • 10
  • 1
    [Please do not upload images of code/errors when asking a question.](//meta.stackoverflow.com/q/285551) – CBroe Jun 30 '21 at 10:01
  • 1
    Enable phpMailer’s SMTP debug mode, and see what additional info that gets you. – CBroe Jun 30 '21 at 10:02
  • It's very likely that [this will help](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#gmail-oauth2-and-allow-less-secure-apps). – Synchro Jun 30 '21 at 10:06
  • @CBroe Thank you ! As I begin with PHPMailer I didn't know about it and it helped me to find my problem. Btw I found solution here : https://stackoverflow.com/questions/21937586/phpmailer-smtp-error-password-command-failed-when-send-mail-from-my-server – KenTay7 Jun 30 '21 at 10:33

0 Answers0