Forum Moderators: coopster
I just created a program that allows you to find out if the email you sent out has been read by the recipient or not. I'm using a tracking image that's downloaded when the recipient opens the email. The program would then email the sender a notice.
<img src=http://www.mydomain.com/image_generator.php width=5 height=5>
Everything works fine. But the problem is every time the sender reads his own email (from the Sent or Archive folder), the tracking image is also downloaded and therefore sending the alert incorrectly.
What is the best solution to stop it from doing this?
My first thought was to use the IP address to identify that this is the sender's machine, not the recipient's, therefore ignore the trigger. But then, from my knowledge, many people especially on dial up are on a dynamicaly assigned IP. I may be able to use the IP for the session, but what happens the next time the sender reads his own email again?
My next thought was to use cookies. I can set the cookie to the sender's machine with no problem. But I don't know how to read it back. I tried to access the cookie by using the usual $_COOKIE[] function from my image_generator.php. But it didn't work. It returned empty. Is it because the tracking image is now downloaded into the user's email program, not browser? Or is it because I'm trying to read it from my image_generator.php that I use to output an image? Can you read the cookie from an image generating script?
Any idea?
Thanks.
If this was for a special use, you could install another email program specifically for those emails (assuming you have an account you are using just for this). There are many free email programs out there too with image block options. This way it would not affect your normal email software.
One thing I would recommend is not using a .php file in an IMG link. It will sometimes confuse the browser. I recommend this solution (Which I have used for many things),
Setup a special directory for the script. Give the script a gif (or whatever kind of image type it is generating) extension. In your .htaccess or httpd.conf file, you can specify for php code to be processed in gif files (or whatever) for that particular directory.
That way you keep the client software 100% happy. :)
I actually used this method for some people when I created an automatic image-rotator script. The forum software they were using would not accept a php file, so it basically got tricked into doing it anyway, by faking the extension :)
But what if the sender opens his own email BEFORE the recipient gets it?
the majority of people use HTML email.
The majority of people will not open "sent" mail as well. That was kind of my point in asking an above question. What I was trying to convey is that it's impossible to make it 100% fool-proof. You have to take error margin into account.