Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

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

1 Answer

0 votes
by (106k points)

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> you

wanted.</p>""" 

sender = Mailer('smtp.example.com') 

sender.send(message)

Related questions

0 votes
1 answer
0 votes
1 answer
asked Sep 6, 2019 in Web Technology by Tech4ever (20.3k points)
0 votes
1 answer
asked Nov 23, 2020 in Azure by dante07 (13.1k points)
0 votes
1 answer
asked Jul 6, 2019 in Azure by Han Zhyang (19.7k points)
0 votes
1 answer

Browse Categories

...