Back
How can I send the HTML content in an email using Python? I can send a simple text.
You can use the below-mentioned code for sending HTML email using Python:-
from mailer import Mailer from mailer import Message message = Message(From="[email protected]", To="[email protected]")message.Subject = "An HTML Email" message.Html = """<p>Hi!<br> How are you?<br> Here is the <a href="http://www.python.org">link</a> youwanted.</p>""" sender = Mailer('smtp.example.com') sender.send(message)
from mailer import Mailer
from mailer import Message
message = Message(From="[email protected]", To="[email protected]")
message.Subject = "An HTML Email"
message.Html = """<p>Hi!<br>
How are you?<br>
Here is the <a href="http://www.python.org">link</a> you
wanted.</p>"""
sender = Mailer('smtp.example.com')
sender.send(message)
31k questions
32.8k answers
501 comments
693 users