MYMESSAGE = "<div>Hello</div><p></p>Hello"
send_mail("testing",MYMESSAGE,"noreply@mydomain.com",['assdf@gmail.com'],fail_silently=False)
但是,此消息在发送时并未获得 HTML mime 类型。在我的 outlook 中,我看到了代码...
最佳答案
来自 the docs :
msg = EmailMessage(subject, html_content, from_email, [to])
msg.content_subtype = "html" # Main content is now text/html
msg.send()
您只能更改它看起来的 mimetype 的子类型。所以一直都是
"text/%s"% msg.content_subtype
关于python - 如何在 Django 中发送具有特定 mimetype 的电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2712484/