我正在使用 MIMEText 通过 python 发送电子邮件。
一个粗略的例子:
message = MIMEText('Hi,\n\nYour taxes are due.\n\nTODAY.\n\nBest,\n\nIRS.')
如果我希望“今天”在电子邮件中显示为斜体和/或粗体怎么办?
最佳答案
MIMEText 支持 html 格式。你可以这样做:
message="""\
<html>
<head></head>
<body>
<b>"""This is bold"""</b>
<i>"""This is italic"""</i>
</body>
</html>
"""
MIMEText(message,'html')
关于Python MIME 文本格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21889046/