Hotmail断开Html选项卡

2024-07-01 06:41:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在测试用gmail和outlook中的MailgunAPI发送电子邮件

我正在从selenium(网页)抓取一张桌子

elem = driver.find_element_by_xpath('//table[@id="mainTable"]')
            resp = elem.get_attribute('innerHTML')

给它添加一个主体

resp = "<<!DOCTYPE html><html><head><title>Title of the document</title></head><body>"+str(resp)+"</body></html>"

通过邮枪发送

r = requests.post(
"https://api.mailgun.net/v3/mysandbox.mailgun.org/messages",
auth=("api", "my-key"),
files=attachlist,
data={"from": "mailgun@mysandbox.mailgun.org",
"to": ["recipient1@gmail.com", "recipient@hotmail.com"],
"subject": "the subject",
"text": "The text",
"html": resp}

gmail完美地展示了一切

enter image description here

Outlook以乱码状态显示相同的电子邮件

enter image description here

我做错了什么

任何指导都会很有帮助


Tags: theorgcomapititle电子邮件htmlbody

热门问题