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 :
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.