相关疑难解决方法(0)

使用Python发送HTML电子邮件

如何使用Python在电子邮件中发送HTML内容?我可以发送简单的文字.

python email html-email

243
推荐指数
8
解决办法
30万
查看次数

Python - 通过Outlook 2007/2010和win32com发送HTML格式的电子邮件

有没有办法使用Python的win32com.client(使用Outlook 2007/2010)发送HTML格式的电子邮件.我现在使用的格式如下所示:

import win32com.client
olMailItem = 0x0
obj = win32com.client.Dispatch("Outlook.Application")
newMail = obj.CreateItem(olMailItem)
newMail.Subject = "the subject"
newMail.Body = "body text"
newMail.To = "recipient@example.com"
attachment1 = "c:\\mypic.jpg"
newMail.Attachments.Add(attachment1)
newMail.Send()
Run Code Online (Sandbox Code Playgroud)

这将使用Outlook发送电子邮件,该电子邮件从当前经过身份验证的用户发送到指定的收件人,其中包含主题,内容和附加图像.

我希望能够发送内嵌图像,这可以使用"嵌入式"附件实现,或者只是使用HTML链接到图像,或者使用HTML和Base64编码的图像嵌入图像.

HTML是我的首选方法,但我添加到正文的任何​​HTML都被格式化并编码为纯文本(例如<变为&lt;).有没有办法告诉Outlook正文内容是HTML,应该这样解析?

html python email outlook

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

email ×2

python ×2

html ×1

html-email ×1

outlook ×1