Sending HTML email using Python

前端 未结 10 1147
小鲜肉
小鲜肉 2020-11-22 04:57

How can I send the HTML content in an email using Python? I can send simple text.

10条回答
  •  粉色の甜心
    2020-11-22 05:05

    You might try using my mailer module.

    from mailer import Mailer
    from mailer import Message
    
    message = Message(From="me@example.com",
                      To="you@example.com")
    message.Subject = "An HTML Email"
    message.Html = """

    Hi!
    How are you?
    Here is the link you wanted.

    """ sender = Mailer('smtp.example.com') sender.send(message)

提交回复
热议问题