I am trying to send emails from Django using an email configured by Google Apps, my configuration at the settings.py
file looks something like this:
<
Set up an ssh tunnel to the server in question so that you could, from your home computer, log in to the gmail web client using the server's IP. You probably need to tunnel port 80 and port 443, maybe just 443. After logging in through the web client the problem should go away according to knowledge base article listed in the SMTPAuthenticationError.
Here's an example of how to set up the tunnel: http://www.noah.org/wiki/SSH_tunnel#simple_port_forwarding_.28SSH_tunneling.29
I found the solution at: https://support.google.com/accounts/answer/185833?hl=en and finally https://security.google.com/settings/security/apppasswords
If you are testing your project on a local machine, you should go to the latter link, and enable "Access for less secure apps".
change your settings at https://www.google.com/settings/security/lesssecureapps so that your account is no longer protected by modern security standards.
I got the following response from Google Apps support:
You need to turn on your Outbound relay. To do this:
- Log into your account at google.com/a/yourdomain.com
- Click the Settings tab and then select Email in the left column.
- In the Outbound relay section, select Allow users to send mail through an external SMTP when configuring a "from" address hosted outside your domain.
- Click Save changes.
They also provided a help link: http://support.google.com/a/bin/answer.py?hl=en&answer=176054
After turning on Outbound relay and using the proxy to login to the webmail one more time (thanks to @DaniloBargen and @joshcartme) the issue was resolved. I've read the link explaining what the Outbound relay is and I'm not really sure why would I need it (I don't believe I'm using an external SMTP server).
Since I'm not really sure this is what solved the issue I won't mark the response as accepted until I get some confirmation.
Recently, I have found that this issue can be resolved by confirming that the activity has originated from a request I initiated, by visiting Google Account
I had to confirm, under Security Events, that the suspicious activity was in-fact me, even though the originating server from where the request came from was cloud hosted, and therefore over 1000 km away. After clicking this step, and setting less secure apps, I was able to use getmail to retrieve my mail, over ssl using either imap or pop.
Do you have two factor authentication enabled for the apps account ? Then you might need to use an application specific password for that application.