Django -- 发送HTML格式的邮件

提前在setting中设置邮箱server

from django.core.mai import EmailMessage
subject, from_email, to
= 'xxx', 'noreplay.com', ['xxx'] html_content = "<p>This is an <font size=3 color='green'><strong>important</strong></font> message.</p>" msg = EmailMessage(subject, msg1, from_email, ['xxx']) msg.content_subtype = 'html' msg.send()
原文地址:https://www.cnblogs.com/polly-ling/p/9950792.html