72449

images inside gmail email not being displayed

Question:

I know gmail and hotmail have introduced their own image proxies. I have sent email with simple img tag with src

src="http://www.zong360office.com/assets/images/logo/product-logo.png"

and gmail converts it like this

src="https://ci3.googleusercontent.com/proxy/PCxvUIqBvaJWn_7H8deiQhdJD1QKV_pU5n1JhrPh3xaXMLMzcdSBYCo6-tjs69AYy858H4j5ShIRjw0UrH_VWMtCxC0zIT-Gi4j_dlQv9uRZjzGWFWA=s0-d-e1-ft#http://www.zong360office.com/assets/images/logo/product-logo.png"

Original URL is the direct URL to the image. In the attached image, you can see the request and response headers for this image.

<strong>Problem: Please let me know what steps should I take to make this image visible inside gmail.</strong>

PS: I am facing the same issue with hotmail as well.

Answer1:

<strong>I think I have figured out the GoogleImageProxy issue.</strong>

I have answered this in another question as well ( <a href="https://stackoverflow.com/questions/28965219/images-inside-gmail-email-not-being-displayed" rel="nofollow">images inside gmail email not being displayed</a> ).

This is something related to CACHING concept. suppose, you have recently deployed your php code on your server but you forgot to upload images. you tested once with your email logic. your system generated an HTML email. When this email will hit the gmail server GoogleImageProxy will try to fetch and store the images from your site to its own proxy server. while fetching the images, GoogleImageProxy found some 404 statuses against your missing images and 403 against some protected images. GoogleImagesProxy has stored these statuses into its own proxy server.

Now tried to open your email, you noticed some 404 statuses against your images. This is something understandable. You immediately realized that you forgot to upload some images, so you uploaded them to your server. and also you have fixed some permissions against protected images.

You are all done now. Now you try to run your php-email script once again. As a result you receive another email in your Gmail or Hotmail inbox. you had fixed all the issues with your images. Now the images must be displayed in your email content. but you are still unable to see the images.

Ah, possibly you forgot to clear your browser's cache. Clear your browser's cache and load the gmail or hotmail page once again. But the result will be still the same. Try to apply dozens of fixes/patches and try to run your php-email script a thousands time. But the result will be still the same. No improvement.

<strong>THE REAL PROBLEM</strong>

What the hell is going on? Let me explain it to you. Go to your access log and try to find requests from GoogleImageProxy. You'll be surprised to see that there will be only 2 or 3 three requests from GoogleImageProxy depending on the number of different images used in your email. GoogleImageProxy never tried to fetch images Even after you have fixed the issues with your images by uploading missing images and setting permissions for protected images. Why? Clearing your browser's cache has no impact. GoogleImageProxy will never fetch the fresh images even for your newer email because the images are now cached into GoogleImageProxy along with their last status code and not cached in your own browser's.

GoogleImageProxy has set its own expiry date for the images. I think one month. so now the fresh copy of images will be fetch after expiry date. I mean after one month. You can not force GoogleImageProxy to fetch the images. But its important for you to display images in your email. What can be the solution?

<strong>THE SOLUTION</strong>

Following is the only way to force GoogleImageProxy to fetch your images

<ul><li>Rename your images to something else with png, jpg or gif extensions only.</li> <li>Don't use any kind of query string in your image url like "?t=34343"</li> <li>your image must include png, jpg or gif as an extension.</li> <li>your image url must be mapped onto your image directly.</li> <li>If you need to use some proxy url for your protected images then your</li> <li>response must include the proper header like "content-type:image/jpeg"</li> <li>File extension and content-type header must match</li> <li>Status-code must be 200 instead of 403, 500 etc</li> </ul>

<strong>IMPORTANT NOTE</strong>

Try to repeat the whole process for every run of php-email script. because every time GoogleImageProxy will cache your images and you'll have to repeat the same process for every new try.

Hopefully this will fix the issue for most of the people. In my case this has fixed the issue.

Answer2:

hese are embedded images. You send an image as an attachment and then use it in your img element like: . Gmail transforms the "cid" link to its internal file storage link and that's why it gives element.

This is one of two common ways to have images within email.

The other way is to keep images in your hosting and send img elements with external links: <a href="http://yourdomain.com/yourimage.png" rel="nofollow">http://yourdomain.com/yourimage.png</a> I strongly recommend to use the second approach especially if you expect to have a lot of images in your email. I had problems with attached images display on Gmail which I couldn't solve.

Answer3:

Make sure your <strong>from</strong> address is a real valid email and not in the form realname+something@example.com.

<hr />

I'm using Amazon SES to send emails, and inlining some but not all images as attachments. For me it was the non-attachments that were breaking.

Eventually I realized I was using a 'fake' email for the from field.

My real email is

simon@example.com

To make it easy to filter emails in gmail I used the + syntax to create a 'fake' email for testing purposes.

simon+test@example.com

This works great, except it seems to be changing the behavior of the spam/image filter. My image tags ended up completely stripped of the src attribute.

As soon as I switched back to using the actual email then all the images showed up.

Recommend

  • How to avoid a growing delay with ffmpeg between sound and raw video data ?
  • Exceptions in Java. What for do we have more than one checkable and one uncheckable class?
  • Limit Apache Proxy upload speed per connection/ip?
  • Why does non-const method hide const overload?
  • longest common subsequence: why is this wrong?
  • JFreeChart heap space
  • Meteor: Block access to application if user's email is not verified
  • Authentication - JavaScript - Logout issue
  • phpmailer - How to verify a sent email arrived at its destination
  • Zend Framework + Doctrine1.2 project structure with more modules
  • Using an STL Iterator without initialising it
  • Should I be afraid to use UDP to make a client/server broadcast talk?
  • How do I translate LR(1) Parse into a Abstract syntax tree?
  • Git describe fails to return most recent annotated tag
  • Autofac with Web API 2 - Parameter-less constructor error
  • Laravel: Getting Session ID oddly truncates when using foreach
  • Bypass multiple inheritance in Java
  • Time complexity of a program which involves multiple variables
  • Admob requires api-13 or later can I not deploy on old API-8 phones?
  • Test if a set exists before trying to drop it
  • Bad request using file_get_contents for PUT request in PHP
  • Spark fat jar to run multiple versions on YARN
  • Asynchronous UI Testing in Xcode With Swift
  • Scrapy recursive link crawler
  • Recording logins for password protected directories
  • how to do an event when i swipe from fragment to the other
  • Spring Data JPA custom method causing PropertyReferenceException
  • Is there any way to access browser form field suggestions from JavaScript?
  • NetLogo BehaviorSpace - Measure runs using reporters
  • How to redirect a user to a different server and include HTTP basic authentication credentials?
  • Perl system calls when running as another user using sudo
  • Can I make an Android app that runs a web view in Chrome 39?
  • Hazelcast - OperationTimeoutException
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Java static initializers and reflection
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • LevelDB C iterator
  • Linking SubReports Without LinkChild/LinkMaster