通过python发送时,电子邮件中的图像未在iOS上显示

问题描述

我们正在尝试使用python设置自动邮件程序。发送电子邮件时,它会在Gmail和其他android邮件客户端上为我们的用户显示图像,但在iOS邮件客户端上似乎没有显示图像。

我们不确定如何解决此问题。我们已经尝试过iframe,base 64以及将图像作为附件发送的方法,但这似乎行不通。

我们当前正在使用smtplib并发送MIME消息

message = MIMEMultipart("alternative")
...
part1 = MIMEText(text,"plain")
part2 = MIMEText(html,"html")
message.attach(part1)
message.attach(part2)
...
...

<a href="#"><img src="https://test.png" ></img></a><a href="#">
...

它应该是这样的:

This is how it should look like

这是它的样子:

This is what it looks like

解决方法

好吧,事实证明Apple Mail不支持vh,因此我们只是更改了图像的高度和宽度,以像素为单位进行格式化,并且可以正常工作。感谢您的帮助!