我正在尝试使用由 Google Apps 配置的电子邮件从 Django 发送电子邮件,我在settings.py
文件中的配置如下所示:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'contact@mydomain.com'
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
当我尝试使用以下方式发送电子邮件时:
from django.core.mail import send_mail
send_mail("Happy new year", "We wish you the best for 3001",
"contact@mydomain.com", ["someuser@gmail.com"])
我收到以下错误:
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')
由于我在没有图形用户界面的远程服务器上工作,我什至无法尝试从浏览器登录。