问题描述
最近,Google 宣布,出于安全考虑,Gmail 将使用代理加载外部图片.这导致我的应用程序在 gmail 中显示图像时出现问题.
Recently Google announced that Gmail will load external images using a proxy for safety purpose. This causing an issue for my application while displaying images in gmail.
Gmail 图片元素检查:https://ci5.googleusercontent.com/proxy/N4RZncgANd5glVi64ElKxecSE10SH6iAhu2VKOK3jJtgaRKBUsqwOn6iDwY49unvlD9Xi6cSZp0T4u1N_KHhBY-TxFaV8PvPNSMn4A=s0-d-e1-ft#http://localhost:8080/email/thread/1301/images/correct)不重复>올바른답변
Gmail image element inspection:https://ci5.googleusercontent.com/proxy/N4RZncgANd5glVi64ElKxecSE10SH6iAhu2VKOK3jJtgaRKBUsqwOn6iDwY49unvlD9Xi6cSZp0T4u1N_KHhBY-TxFaV8PvPNSMn4A=s0-d-e1-ft#http://localhost:8080/email/thread/1301/images/correct) no-repeat">올바른 답변
根据上面的 HTML,实际图像 URL 前面带有一个 Google 代理 URL,以阻止要显示的图像.如果我们删除这个垃圾 URL,图像开始看起来很好.Apple Mac 邮件不会出现同样的问题.
As per above HTML actual image url is prepended with a Google proxy URL stopping images to be displayed. If we remove this garbage URL, image starts to appear fine. Same issue not appears for Apple Mac Mails.
我们使用 Java Mailing API 提供了邮件功能.请提出建议.
We have provided mailing feature using Java Mailing API. Please suggest.
谢谢,迪维亚·加格
推荐答案
这里的问题是您用于邮件的 URL.从提供的信息来看,它似乎是:
The problem here is the URL you are using for your mailings. From the information provided, it appears to be:
http://localhost:8080/email/thread/1301/images/correct
这是一个指向本地计算机上文件的 URL.但是,该 URL(而不是实际图像)正在传递给 Google 的代理进行检索.Google 无法从其代理访问该 URL,因此图像不会出现.
This is a URL that refers to a file on your local computer. However, that URL - rather than the actual image - is being passed to Google's proxy to retrieve. Google has no way to access that URL from their proxy, and thus the image will not appear.
解决方案是确保您使用的路径可以在本地网络之外访问;例如,通过将图像托管在面向外部的服务器上.
The solution is to ensure that the path you are using is one accessible outside of your local network; for example, by hosting the images on an externally-facing server.
这篇关于未显示 Gmail 的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!