showing image in email using the php image tracking trick
<p>I am creating a newsletter system which tracks all types of information when emails are opened.</p>

<p>I have started with an image which looks like</p>

<pre><code>&lt;p&gt;&lt;img src="http://xxx.com/newsletterInfo.php?newsletter=12&amp;userid=234" width="314" height="20" alt="Cancel Newsletter Subscription"&gt;&lt;/p&gt;
</code></pre>

<p>Then on the newsletterInfo.php file i am echo'ing the url to the image.</p>

<p>I take it this is not the way of doing this?</p>

<p>Can some please point to me where my problem is.</p>

<p>Thanks</p>

<p><strong>Update</strong></p>

<p>The sending of the email:</p>

<pre><code>            $name = stripslashes($fetchquery["name"]);
            $email = stripslashes($fetchquery["email"]);

            $content = $_POST["maincontent"];
            $subject = $_POST["subject"];
            $message = "&lt;html&gt;&lt;head&gt;&lt;title&gt;".$subject."&lt;/title&gt;&lt;/head&gt;&lt;body&gt;";
            $message .= str_replace('{name}', $name, $content);
            $message .= '&lt;p&gt;&lt;img src="http://xxx.com/newsletterInfo.php?newsletter='.$id.'" width="314" height="20" alt="Cancel Newsletter Subscription"&gt;&lt;/p&gt;';
            $message .= "&lt;/body&gt;&lt;/html&gt;";

            $headers  = 'MIME-Version: 1.0' . "\r\n";
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
            $headers .= 'From: Username &lt;email@here.com&gt;' . "\r\n";

            // Mail it
            mail($email, $subject, $message, $headers);
</code></pre>

<p>On the information page, i have done this:</p>

<pre><code>if(isset($_GET["newsletter"])) {

    $query = $pdo-&gt;prepare("UPDATE newsletter SET opened=`opened` +1 WHERE id=:id");
    $query-&gt;execute(array(':id' =&gt; $_GET["newsletter"]));
    $query_num = $query-&gt;rowCount();

    if($query_num &gt; 0){
        echo 'http://xxx.com/cancel.png';
    }
</code></pre>

<p>As you can see the email sends the newsletter using the mail() function and then where the image is i have put the url of a php file, within this file asks for the variable and if its set it then echos the image url and then inputs data into the database, all this works 100% because the database is being updated.</p>

<p>The problem that is having is the image is broken.</p>

<p>If you right click and go to the newsletterInfo.php the url shows.</p>

<p>I assume that this simply is not the way of doing this.</p>
