phppup Posted May 22, 2023 Share Posted May 22, 2023 I'm trying to track an email message by adding an image to an email. (a very rough attempt to just get a result) <img alt="" src="http://yourwebsite.com/record.php width="1" height="1" border="0" /> My understanding being that when the email is opened, the script will be called, and then send the image to the email. However, the code seems to be ineffective in passing the image. My desktop email shows no image, and my cellphone image shows an error/no image symbol I've tried code as simple as header("Content-Type: image/gif"); readfile("blank.gif"); and as complex as //Full URI to the image $graphic_http = 'http://yourwebsite.com/blank.gif'; //Get the filesize of the image for headers $filesize = filesize( 'blank.gif' ); //Now actually output the image requested (intentionally disregarding if the database was affected) header( 'Pragma: public' ); header( 'Expires: 0' ); header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); header( 'Cache-Control: private',false ); header( 'Content-Disposition: attachment; filename="blank.gif"' ); header( 'Content-Transfer-Encoding: binary' ); header( 'Content-Length: '.$filesize ); readfile( $graphic_http ); with no success. What am I missing? PS: I've tried it at the top and the bottom (where I would want it) of my email message, but no joy. Quote Link to comment Share on other sites More sharing options...
Solution kicken Posted May 22, 2023 Solution Share Posted May 22, 2023 Did you enable remote content in your email client? Most block it by default as far as I know. Quote Link to comment Share on other sites More sharing options...
phppup Posted May 22, 2023 Author Share Posted May 22, 2023 I did not, but I have no issues with viewing the <img src> when written directly into the HTML. Does the remote content setting handle the capability for exactly what I'm trying to accomplish? [of course it does, right... LOL] Quote Link to comment Share on other sites More sharing options...
phppup Posted May 22, 2023 Author Share Posted May 22, 2023 (edited) So this is on the CLIENT side? And therefore has nothing to do with server settings? [I guess I read too quickly. No wonder this is such an unreliable method... LOL] Edited May 22, 2023 by phppup Quote Link to comment Share on other sites More sharing options...
kicken Posted May 22, 2023 Share Posted May 22, 2023 20 minutes ago, phppup said: So this is on the CLIENT side? Yes, for example, in Thunderbird which is what I use, there is this setting: Unless that is checked, anything that requires accessing a remote server to display will not be loaded. The learn more link goes here if you're interested. Since I leave that setting off, most of the marketing emails I get end up like this: A little bit of text, lots of image placeholders / alt text. Some companies manage this better than others. Attaching images or using data: url's will allow them to show, but of course that doesn't help you with your desire to track things. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.