I am sending bulk emails from my organisation. I want to track who has opened the email. I know it's not 100% feasible but still we'll have some stats. When I send emails through Mailchimp or Postmark, I can see they correctly track the opened emails.
The image is located on Amazon S3 and the emails are sent through Amazon SES. I set the src of the image with our url which records the user and then returns the image. If I open that url in browser, it correctly logs the entry and downloads the image.
The problem is that Gmail adds a proxy in front of the image thus the image doesn't load at all. I am using Symfony2.8 and this is the response which I send.
$response = new Response();
$disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'myimage.png');
$response->headers->set("Content-Disposition", $disposition);
$response->setPublic();
$response->headers->set("Content-Transfer-Encoding", "binary");
$response->setCache(array('max_age' => 0, 'public' => true));
$response->mustRevalidate();
$response->setExpires(0);
$response->headers->set("Content-Type", "image/png");
$response->headers->set("Content-Length", 10240);
$response->setContent(file_get_contents("http://some-amazon-link/assets/logo/pressweb/myimage.png"));
return $response;
P.S. I have read almost all the questions about it on Stack and other websites. There may be something wrong with my code. I dunno. Thank you.