One of the website suddenly stopped sending emails from the “Contact Us” form
My fellow engineer tried to debug the problem, but could not.
so I stepped in.
The first thing I tried was to verify that the username/password was correct, by logging into the gmail account via the browser.
It was.
So then I considered changing to TLS from SSL, but before I did that on production setup, I decided to do all the trials locally.
I have a sample code that takes all the mail settings, and sends a test email using python's SMTP library.
If it works, it eliminates the issues related to the “setup”, which includes things like port, SSL or TLS and off course username/password combination.
My first attempt failed with the following error:
|
|
(If you are too lazy to scroll all the way to right to see the complete
error, it says
Please log in via your web browser and then try again
)
Since I had already tried logging via the browser, I was confused. But I tried it anyway.
May be I copy/pasted one less character.
But that was not the case. Browser login worked.
Stackoverflow to the rescue.
Turns out one needs to turn ON “allow less secure apps” option in accounts settings.
I did (Just to see whether it will work.) and test email was sent successfully.
And so did the email from the “Contact Us” form.