Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
568 views
in Technique[技术] by (71.8m points)

email - How can I avoid google mail server asking me to log in via browser?

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:

EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True

When I try to send an email using:

from django.core.mail import send_mail

send_mail("Happy new year", "We wish you the best for 3001",
    "[email protected]", ["[email protected]"])

I get the following error:

SMTPAuthenticationError: 
(535, '5.7.1 Please log in with your web browser and then try again. 
 Learn more at
 5.7.1 https://support.google.com/mail/bin/answer.py?answer=78754 k2sm758604obl.14')

Since I'm working on a remote server with no graphical user interface, I cannot even try to login from the browser.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just go to https://accounts.google.com/DisplayUnlockCaptcha and click "continue". This is going to allow access from other servers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...