Django -- 发送HTML格式的邮件

 

提早在setting中设置邮箱serverhtml

 

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()
相关文章
相关标签/搜索