Forums

Flask mail not working

Hey PythonAnyhwere:

I'm a new user looking to host my small Flask web app. Unfortunately, currently flask mail not working after hosted. It's perfectly working in my local machine. I attach 2 pictures with the mail configurations. I tried both settings, but didn't work. Can you assist me?

settings 1 : enter image description here settings 2 : enter image description here

Thanks!

The first one of those should work fine. What error are you getting (if any)? One possibility is that Gmail isn't recognising the IP address the connection is coming from and is blocking it as a security measure. There are some hints on how to deal with that on this help page.

Thanks for the reply, but still it's not working. is smtp.gmail.com is blocked for free users?

Nope, it is not. Are you sure it's not google blocking the login because they don't recognize the IP address?

Just to make sure: you don't have two factor authentication on?

two factor authentication is off, but mail is not sent. There is no error in the error log.

If the mail is not making it off PythonAnywhere, I would expect an exception. Are you sure you're not catching any exceptions from the mail code? Or maybe you've configured Flask to ignore exceptions when sending mail? Or perhaps the code you think you're running isn't actually the code that is running?