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