Report this

What is the reason for this report?

Unable to send mail through smtp.gmail.com

Posted on March 10, 2014

I have recently become unable to send any e-mail from my Django app hosted on a DO droplet through smtp.gmail.com. Any time I try, I get the following error message:

SMTPAuthenticationError (535, ‘5.7.8 Username and Password not accepted. Learn more at\n5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 sh5sm32272477pbc.21 - gsmtp’)

Which is weird, because the username and password used works perfectly when I try to log in manually, or when sending through the exact same Django app from localhost.

I have also tried going through http://www.google.com/accounts/DisplayUnlockCaptcha , as mentioned in the Google support answer.

I have been sending at maximum a couple of hundred e-mail in total from that account, with maybe ~10 a day - so abuse seems to be out of the question for me. I should mention that the account is a paid Google Apps account.

The fact that I can use the exact same settings while using localhost as a server, plus the fact that this error has only appeared recently, makes me think that the error might have something to do with Digital Ocean.

Do you have any ideas about what might cause this?

Thanks and with the best regards, Martin

Ps. for good measure, here are my smtp settings, minus the password (which I am 100% sure is correct):

EMAIL_USE_TLS = True EMAIL_HOST = ‘smtp.gmail.com’ EMAIL_PORT = 587 EMAIL_HOST_USER = ‘info@CoCreately.com’ EMAIL_HOST_PASSWORD = <redacted>



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I found out my Google password had special characters, which led to the /etc/postfix/sasl_passwd not being properly read. Simply the password (long one ofc) with up/lower case characters, numbers.

I also combined the settings found here if you still have trouble:

https://documentation.wazuh.com/2.0/user-manual/manager/output-options/manual-email-report/smtp_authentication.html

https://opentodo.net/2013/03/postfix-smtp-relay-to-smtp-gmail-com/

Same issue here, although my application is a Ruby on Rails 3.2 app. <br> <br>The code was working for months, and stopped working in the past few days.

how i find my account is cannot openinG

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.