Image not showing in Gmail - Using django python-postmark

Viewed 1350

I've used django python-postmark for mailing. Now my problem is that my static images are not shown on Gmail. Gmail prepends a url proxy to the src of the images. if the prepended url proxy is removed, the image will show perfectly. What am I missing here? or how do I fix this? thanks

These are my code for the image. this supposed to result to src="https://mysite_here.com/static/img/img.png"

{% load static %}
{% load custom_tag %}
<img src="{% site_url %}{% static 'img/img.png' %}">

But upon showing on gmail, the src is now prepended which causes the image to not show. Here's what the gmail generated:

<img src="https://ci3.googleusercontent.com/proxy/rYDcSW7inrn8_vlXhcrSojT1T06pKEKyrzmXgb5cje_JCc9ze25emLbFDuBub3CWP_ASqgUXbqn6RureN5Fy0Nd-eFdllL14aq16UQ_rXrB4-dWp=s0-d-e1-ft#https://mysite_here.com/static/img/img.png" class="m_-186473825407072632logo CToWUd">
2 Answers

I was testing when Gmail request the image, using python SimpleHTTPServer, as suggested in this post: https://blog.filippo.io/how-the-new-gmail-image-proxy-works-and-what-this-means-for-you/ and realized that the image was actually been reached.

The problem was that I was serving a .svg image. I realized this was the error by reading this another question: https://webmasters.stackexchange.com/questions/123969/images-from-googleusercontent-com-giving-404.

Once I replaced the image for a .png and .jpg it started to work.

Hope this can give some light. I don't really know why Gmail can't handle .svg

Personally, I solved this issue by writing out <img src="https://.."> in the image source URL. For some reason, Postmark does not deliver the images properly if written simply <img src="//domain.com">. I'm not sure why this breaks but adding the https solved it for me.

Related