【发布时间】:2019-10-17 13:29:49
【问题描述】:
我在 ubuntu 16.04 DigitalOcean 中使用 django send_mail 从 office 365(Godaddy) 发送邮件时遇到一个问题。
这是我的实际配置:
EMAIL_HOST = 'smtp.office365.com'
EMAIL_HOST_USER = "myuser"
EMAIL_HOST_PASSWORD = 'mypassword'
EMAIL_USE_TLS = True
EMAIL_PORT = 587
发送邮件:
context = {}
subject = 'Verificación de registro con 1 clic'
txt_ = get_template("registration/emails/verify.txt").render(context)
from_email = settings.DEFAULT_FROM_EMAIL
recipient_list = [somemail@somemail.com]
html_ = get_template("registration/emails/verify.html").render(context)
sent_mail = send_mail(
subject,
txt_,
from_email,
recipient_list,
html_message=html_,
fail_silently=False,
)
这是引发的错误:
raise SMTPSenderRefused(code, resp, from_addr)
smtplib.SMTPSenderRefused: (530, b'5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM []', '=?utf-8?q?myuser?= <myemail@myemail.com>')
【问题讨论】:
标签: django office365 digital-ocean