Search code examples
ruby-on-railsemailgmail

Custom email tracking not sending request when opened in Gmail


I´m trying to develop a custom email tracking system for my Rails webapp following the pixel approach. If I understood it right, the idea is to insert a one pixel image with source to a url that process the request. In my case, when the request is process it sends a new notification email to me.

In the email body I have inserted:

<img src="localhost/api/to?trackId=<%= id %>" style="display: none"/>

When I open the email in web Gmail with Chrome, I see next code, but unfortunately nothing happens:

<img src="https://ci4.googleusercontent.com/proxy/ncea8tesMNBOixfbJrQ1VL458oukzkLaIlWW6RbqedZ9mkMjsfgeIAWa5EWXcX4HOi0vLwDmFg=s0-d-e1-ft#http://localhost/api/to?trackId=1435" style="display:none;outline:none;text-decoration:none;height:auto!important;border:0" class="CToWUd">

When I just type the url directly in my browser, like: http://localhost/api/to?trackId=1435 my server gets the request and process it perfectly.

I have read in some other posts that Gmail is proxing the image and this is not working anymore. However, I think there should be one approach if there are lots of mail tracking services.

Do I have a mistake in my code, or should I try another approach?


Solution

  • Google replaces all images with copies in their cache. This copy cannot be retrieved from your localhost obviously.