Hello, I want to track if the sent email is read or not (i know second time, i can't track because of image proxy server. i need only tracking of first time when the user clicks). I'm using this code snippet. But, unfortunately it is not working as expected. I tried googling for hours but no improvement. Can somebody suggest me? $headers = "From: "; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = ""; $subject = 'Mail Test - ' ; $message = "Hi This is testing <br/> <img src='tracker.php' width='1px' height='1px' /> <br/>after tracking pixel image"; if(mail($to, $subject, $message, $headers)) { echo "sent"; }else { echo "error"; } Thanks, Hussain Badusha.
Thanks for the response. Then how do i track. $message = "Hi This is testing <br/> <img src='filename.png' width='1px' height='1px' /> <br/>after tracking pixel image"; If i use the above message and send it. How can i know if the email is read or not. Really, i don't know how to do that? I await for you reply Thanks, Hussain Badusha.
This article relates to your issue: https://blog.mailchimp.com/how-gmails-image-caching-affects-open-tracking/
Thanks ThePHPMaster, I've checked that link. They said "our image-hosting servers get a request for the pixel-sized pic, and we use that request to track opens for each subscriber" But in my side, what should i do? I put image tag along with tracking file. But gmail won't request to my server (localhost) when i click on the particular email. Any help would be greatly appreciated. Thanks, Hussain Badusha.
Hi. Can somebody help me? It would be great if you anyone gives me a code snippet that does request from gmail to localhost server. I await... Thanks, Hussain Badusha.
Uhm... wait. You're trying to get Gmail to access something on localhost? Without having localhost available on the Internet? Are you just stupid, or aren't you grasping how localhost works?
Use the full URL to "tracker.php", not just the script name. How is Gmail supposed to know the domain it's on? Magic? lol
As a recap. 1. Use the full URL to the "image" 2. Set a handler that allows a particular image filename be executed as a php script so you can use whatever.jpg 3. Use the correct HTML header and html code if you plan to use the img src code. 4. Don't be stupid.
Thanks for all of you help. May be i should have clearly posted the code. Let me show you once again with little more in detail. $headers = "From: "; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = ""; $subject = 'Mail Test ' ; $message = "Hi This is testing <br/> <img src='localhost/tracker.php' width='1px' height='1px' /> <br/>after tracking pixel image"; if(mail($to, $subject, $message, $headers)) { echo "sent"; }else { echo "error"; } The above code snippet tracks promptly as expected, when user opens the particular mail that i sent. And i can also store the required information in my db on my localhost server. But, the only problem is that i can't track it on gmail.com and live.com. Other than these two services, i can go smoothly in tracking without any single issue (yahoo.com, zoho.com, yandex.com, india.com, swissmail.net and few more). Regarding running it one localhost, i also put it my code in online and checked it but no improvement. Still, i can't track information from gmail and live.com. Thanks, Hussain Badusha.
You aren't listening. Do NOT link to it on localhost. Do NOT link an img src to a .php extension. Even IF Google would allow you....you don't even have the http intact for it to be valid. But that's irrelevant...host the script on thw world wide web. Use a handler so allow a specific.jpg file to execute as a PHP file. Then use the appropiate header and html formating.
Hi, Thanks for the quick response @NetStar Actually, there was "http://" before localhost in code snippet. That's why i can track info. Let me give it a try as you are suggesting me to use handler on image. First of all, pardon me for too much questions right away coming... How can i set handler on image and how to track it? Should image name (specific.jpg) be valid or just a name? I really don't know how to do that. Do you have any sources that i can learn from? or Do you have any sample code? Again... Thank you very much for quick reply. Hussain Badusha.
Hi folks, I'm grateful to you all... Thank you very much guys... Finally, i got it working. I'm really so ashamed that how stupid i've been all over this thread (i was so stubborn keep trying it on localhost). Eventually, with the help of setting handler for image and using rewrite rules, it worked like a charm. Once again thank you so much and i'm pretty much happy right now... Hussain Badusha.