Python - how to change font of email text

I am writing an application that generates a full report and its summary, and sends them by email. The summary is sent as text via e-mail, and the full report is sent as an attachment. I found an example ( link ) that works fine, but I will need to set the font of the email message font as monospace (for example, "Courier New").

Any idea how to do this?

Thanks in advance.

+4
source share
2 answers

Email will send both plain text and HTML. A plain text renderer will usually be displayed in a monospaced font, but there is no guarantee. More importantly, you cannot do anything to change which font will be displayed in clear text.

If your recipient reads mail in an HTML-enabled mail client, you can do this by wrapping the <font face="Courier New, Courier, monospace"></font> (font tag) around the parts of the letter that you would like to have in Courier . In the proposed method, you just have to:

 text = '<font face="Courier New, Courier, monospace">' + text + '</font>' 

If you want this to be your full email address.

+8
source

You must create an HTML e-mail and insert the necessary tags.

-1
source

All Articles