简体   繁体   English

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

[英]Images in emails are not displaying on iOS when sent through python

We are trying to set up an automated mailer using python.我们正在尝试使用 python 设置自动邮件程序。 When it sends out the email, it displays images for our users on Gmail and other android mail clients, but does not seem to show the images for iOS' mail client.当它发送电子邮件时,它会在 Gmail 和其他 android 邮件客户端上为我们的用户显示图像,但似乎没有为 iOS 的邮件客户端显示图像。

We are unsure how to fix this.我们不确定如何解决这个问题。 We have tried iframes, base 64, as well as sending images as attachments and it did not seem to work.我们尝试过 iframe、base 64 以及将图像作为附件发送,但似乎没有用。

We are currently using smtplib and send MIME messages我们目前正在使用 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:这是它的样子:

这是它的样子

Alright, turns out Apple Mail doesn't support vh, so we just changed the image height and width to be formatted by pixels instead and it worked.好吧,事实证明 Apple Mail 不支持 vh,所以我们只是将图像的高度和宽度更改为按像素格式化,并且它起作用了。 Thanks for the help!谢谢您的帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM