I'm playing with the idea of adding email tracking to a web service I built for a small client business. I was planning on doing the embedded image solution (with reference to an image on my server) - unless someone else has a better method - but when I use the image tag referencing a PHP page on my server it loads the "broken image" icon. How can I make this a valid image?
Here is the code for the mailing PHP page:
<?php
$body = "<html>Hello there!".
"<img src='http://mysite.com/track.php?name=bob' />".
"</html>";
$subject = "Tracking on ".date('Y-m-d H:i:s');
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: webmaster@mysite.com' . "\r\n";
mail('my_email@gmail.com',$subject,$body,$headers);
?>
And here is the tracking code:
<?php
include('database_connection.php');
$query = "INSERT INTO tracking SET name='".$_GET['name']."', date=NOW()";
mysql_query($query);
// Tried this, but it doesn't work:
echo "<img src='http://mysite.com/photos/image.jpg'>";
?>