如何停止在电子邮件中缓存图像

本文关键字:缓存 图像 电子邮件 何停止 | 更新日期: 2023-09-27 18:01:27

我正在使用c#和Amazon SES发送电子邮件。这封电子邮件由几张图片组成。当我第一次在客户端打开电子邮件时,它从主机加载了所有图像,但当我第二次打开它时,似乎所有的图像都是预加载的,我不想要这种行为。我知道这是因为缓存,但我怎么能强迫不缓存这些图像和每次从主机服务器重新加载。

有什么想法吗?

如何停止在电子邮件中缓存图像

尝试放置网页。配置文件在您的电子邮件图像目录。这应该向电子邮件客户端(当请求图像时)表明,所提供的这些图像不会被缓存(前提是所述电子邮件客户端正确实现HTTP协议)

<?xml version="1.0"?>
 <configuration>
  <location>
   <system.web>
    <authorization>
     <allow users="*" />
    </authorization>
   </system.web>
   <system.webServer>
    <httpProtocol>
    <customHeaders>
      <add name="Cache-Control" value="no-cache" />
    </customHeaders>
    </httpProtocol>
    <staticContent>
     <clientCache cacheControlMode="DisableCache" />
    </staticContent>
   </system.webServer>
  </location>
 </configuration>