chompion
chompion

Reputation: 87

Python MIMEText formatting

I'm sending emails via python using MIMEText.

A crude short example:

        message = MIMEText('Hi,\n\nYour taxes are due.\n\nTODAY.\n\nBest,\n\nIRS.')

What if I want TODAY to be italicized and/or bolded in the email?

Upvotes: 4

Views: 7272

Answers (1)

venpa
venpa

Reputation: 4318

MIMEText supports html format. You can do this:

message="""\
    <html>
        <head></head>
        <body>
            <b>"""This is bold"""</b>
            <i>"""This is italic"""</i>
        </body>
    </html>
    """
MIMEText(message,'html')

Upvotes: 9

Related Questions