Django HTML郵件

    subject, from_email, to = '來自123的測試郵件', '[email protected]', '[email protected]'
    text_content = 'welcome!'
    html_content = '<p>歡迎訪問<a href="http://www.baidu.com" target=blank>百度</a>,</p>'
    msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
    msg.attach_alternative(html_content, "text/html")
    msg.send()

發送HTML郵件代碼如上所示,需要在setting.py中配置相關信息。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章