I want to make a program similar to the chrome extension mailtrack.
It can track when a user opens an email, and I want to do the same.
I have made an image on my webserver so that it will open and write to a file whenever it is requested. (e.g a tracking pixel).
This doesn’t work, because google proxies, and caches the image; rewriting the url to https://foo.googleusercontent.com/proxy/foobarfoobarfoobar#myoriginalurl.
This causes the request not to be made to my server, but googles.
How can I fix this?
And if it is impossible, ok, but then how would the aforementioned mailtrack work?
My code is:
<?php $file = 'image.png'; $fp = fopen('log.log', 'a'); fwrite($fp, 'Opened' . PHP_EOL); header('Content-Type: image/png'); readfile($file); ?>
When you send an email, Mailtrack automatically adds a tracking pixel (a really small image) to that email. Then, when it is opened the tracking pixel is downloaded and sends a call to our servers to let us know the mail has been opened.
Also,
Mailtrack is an email tracking tool. It tells you if your emails have been opened or not, and how many times, through its pixel-based tracking system.
Advertisement
Answer
I have fixed it. I use python to do it now.
My server code for others wondering is:
import flask import random app = flask.Flask(__name__) @app.route('/sig.png') def sig(): print(f'Requested {random.randint(1,9999)}') return flask.send_file('images/sig.png', 'image/png') app.run('0.0.0.0', 8080)