Python - how to change email text typeface

后端 未结 2 1238
南旧
南旧 2020-12-20 18:30

I\'m writing an app that generates full report and it\'s summary, and sends them via email. A summary is sent as text in email, and a full report is sent as attachement. I f

相关标签:
2条回答
  • 2020-12-20 18:46

    You should generate E-Mail in HTML format and insert needed tags

    0 讨论(0)
  • 2020-12-20 18:54

    Email will send as both plaintext and as HTML. A plaintext email renderer will generally be rendered in a monospace font, but there is no guarantee of that. More importantly, there is nothing you can do to change what font the plaintext will display in.

    If your recipient is reading mail in an HTML capable email client, you should be able to accomplish that by wrapping <font face="Courier New, Courier, monospace"></font> (a font tag) around the pieces of the email you'd like to have in Courier. In the method provided, you would simply have:

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

    If you wanted that to be the whole email.

    0 讨论(0)
提交回复
热议问题