0
在Django中,我有通过Gmail帐户发送电子邮件的应用程序。 这是我的settings.py配置麻烦和Django通过Gmail电子邮件,始终为垃圾邮件
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'thepassword'
EMAIL_PORT = 587
,并发送电子邮件(在views.py)的方式:
from_email = '[email protected]' #look that is equal to EMAIL_HOST_USER
template_html = 'my_template.html'
subject = u'The subject'
html_content = render_to_string(template_html, {})
msg = EmailMultiAlternatives(subject, html_content, from_email, ['[email protected]'])
msg.attach_alternative(html_content, "text/html")
msg.send()
用户总是收到垃圾邮件。 这件事情,我做错了吗?
谢谢!
PS:发生在Django 1.4,1.5和1.6同样的问题,所以它的版本无关
感谢@Trik,我如果您使用山魈目前使用的山魈 – azuax
,请务必将您的DKIM和SPF记录。 – souldeux