提早在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()