Forums

web2py: Gmail email failure after changing the account

I had configured my web2py app to send email from email id say "abc@gmail.com" and it was working absolutely fine.

Now, I have changed my gmail id from "abc@gmail.com" to "def@gmail.com" in the web2py configuration. But now, I am not able to send the email and error.log in pythonanywhere reports :-

2014-07-24 09:14:40,933 :Mail.send failure:(534, '5.7.14 https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbv3v\n5.7.14 AQ37AfoHHvjWj3-PlQXmsYcFtOzUS6MKu2EyzJSS1ow1LebNPlv9Bm7HRb4xlO9ncGk_iE\n5.7.14 qi0oHRv8Bi9MA0rr70JDXgyyWWKTQ6PU64XZ_B_uJMwcrV58KUwelyvcVF9jjl1mhHi3Xt\n5.7.14 p6TQ06epcFvBUJQEWHMNMsiZYQZoMbvCn5uMWQCT-9Ezn8_GAtSJQf8Ds8uUmiFjvyzdmf\n5.7.14 FuXdFbQ Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 v2sm4382843qge.7 - gsmtp')

It seems to be specific to Pythonanywhere environment, as if I run the modified code in my local machine, I am able to send emails without any problem. I have tried reloading the app with no success.

Please help !!

This normally happens because Google are seeing you trying to send mail from an unrecognised IP address (one from which you've never logged in via a browser) and they're doing an extra security check to make sure you're not a hacker or a spammer.

If you visit the link that is in your error message (you can just click it in your post above), it should take you to a Google page where you can log in, which will authorise access from the PythonAnywhere servers, and then everything should work fine.

Thanks, but this doesn't seems to work.

I even tried following the other suggestions from net but none of them seems to be working.

Still trying ...

Hmm, odd. Did the error message change again after hitting that link?

Was one of the things you tried going to http://www.google.com/accounts/DisplayUnlockCaptcha, going through the process there and then retrying? (immediately if possible, as I believe DisplayUnlockCaptcha 'unlocks' new location registrations for about 10 minutes)

Seems to be resolved, I followed the below steps :-

  1. Changed the password
  2. Ensure access to app settings (google security) is enabled.
  3. Used the DisplayUnlockCaptcha step as suggested by serenity (I had tried this earlier yesterday but didn't resolved at that time).

Anyways, thanks Giles and Serenity for your support :)

Awesome, thanks for confirming!