简体   繁体   English

iOS15 阻止发送给我的客户的电子邮件中的图像

[英]iOS15 blocking images in emails to my customers

I send emails to my iOS and Android app customers from my server, hosted by JustHost.我从我的服务器向我的 iOS 和 Android 应用程序客户发送电子邮件,由 JustHost 托管。 On an iOS15 device, all the images that are hosted on my server are being blocked (no error message, just an empty box).在 iOS15 设备上,我的服务器上托管的所有图像都被阻止(没有错误消息,只是一个空框)。 There is nothing malicious in the images, no tracking.图像中没有任何恶意内容,没有跟踪。 I can successfully send images from other domains in my emails - but those same images that I copy to my server are then blocked.我可以在我的电子邮件中成功发送来自其他域的图像 - 但是我复制到我的服务器的那些相同的图像随后被阻止。 I called my hosting company and they had no idea.我打电话给我的托管公司,他们不知道。 The emails show up fine in other versions of iOS and everywhere else.这些电子邮件在其他版本的 iOS 和其他任何地方都能正常显示。 I use the img tag in my emails to reference the images, sent using Sendmail in Perl.我在我的电子邮件中使用 img 标签来引用使用 Perl 中的 Sendmail 发送的图像。 What do I need to ask JustHost to do to enable my images to be shown in iOS15?我需要让 JustHost 做什么才能使我的图像在 iOS15 中显示?

The reason your images are blocked on iOS15 is that the iOS Mail app is using "Mozilla/5.0" (as-is) as its User-Agent to download images from Web servers.您的图像在 iOS15 上被阻止的原因是 iOS 邮件应用程序使用“Mozilla/5.0”(原样)作为其用户代理从 Web 服务器下载图像。

This exact User-Agent triggers the ModSecurity module (which is practically installed by nearly all Web hosts), resulting in a "406 Not Acceptable" response status code.这个确切的用户代理会触发 ModSecurity 模块(几乎所有 Web 主机都安装了该模块),从而导致“406 Not Acceptable”响应状态代码。 You can verify it by spoofing your Web browser's User-Agent and visiting any URL in your website, whether the URL points to an existing resource or not.您可以通过欺骗您的 Web 浏览器的用户代理并访问您网站中的任何 URL 来验证它,无论该 URL 是否指向现有资源。

If you have root access to your Web server (which you won't if you are on shared hosting), you can disable a rule in ModSecurity that triggers this.如果您对 Web 服务器具有 root 访问权限(如果您在共享主机上则不会),您可以在 ModSecurity 中禁用触发此操作的规则。 I wouldn't recommend disabling ModSecurity as a whole because it is an excellent module for your server's security.我不建议整体禁用 ModSecurity,因为它是服务器安全性的优秀模块。

Another way to circumvent this issue is by setting an ErrorDocument for 406 with a PHP script that sends the image as output, with corresponding HTTP headers of course.规避此问题的另一种方法是使用 PHP 脚本为 406 设置 ErrorDocument,该脚本将图像作为输出发送,当然还有相应的 HTTP 标头。

I have the same problem as you, and I have figured it out just today.我和你有同样的问题,我今天才弄明白。

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

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