PHP img邮件跟踪器不工作,即使img显示在客户端


php img email tracker not working even if the img is displayed in clients

我试图通过插入像这样的图像来跟踪html电子邮件是否打开:

<img height="210px" width="210px" src="http://example.com/emailimg1/c00015.jpg" style="-ms-interpolation-mode: bicubic;">

,我认为,如果图像显示,那么它必须从我的web服务器下载。所以我将这一行添加到。htaccess:

RewriteRule ^emailimg(.?)/(.*)$ emailTracker.php/$1

和emailTracker.php如下:

<?php 
require_once'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
include "../phpComp/trackEmail.php";
$url = $_SERVER['REQUEST_URI']; 
$pieces = explode("/", $url);
$imgId = substr($pieces[1], -1);
$clientHash = substr($pieces[2],0, -4);
$imgFormat=substr($pieces[2], -4);
trackEmail($clientHash);
$filepath="img/email".$imgId.$imgFormat;
if (file_exists($filepath))
 {
    header("Content-type: image/jpeg");
    header("Accept-Ranges: bytes");
    header('Content-Length: ' . filesize($filepath));
    readfile($filepath);
 }

和trackEmail.php如下:

<?php
function trackEmail($clientHash)
{
    date_default_timezone_set('Europe/Rome');
    $date = date('Y-m-d H:i:s', time());
    $dateDay = date('d-m-Y', time());
    try
    {
        include_once '../absolute/myConnection.php';
        $dbSvr = new Zend_Db_Adapter_Pdo_Mysql($connParams);
    }
    catch (Zend_Db_Adapter_Exception $e)
    {
        //*******debug**********->
        $response=$e->getMessage();
        //echo $response;
        //*******debug**********<-
    }
    catch (Zend_Exception $e)
    {
        //*******debug**********->
        $response=$e->getMessage();
        //echo $response;
        //*******debug**********<-
    }
        $data = array(
                'clientHash'=>$clientHash,
                'date'=>$date
        );
        $insertResult = $dbSvr->insert('emailAccess', $data);
    }
    catch (Zend_Exception $e)
    {
        //*******debug**********->
        $response=$e->getMessage();
        //echo $response;
        //*******debug**********<-
    }
}

:

  • 如果我从浏览器访问我的地址http://example.com/emailimg1/c00015.jpg然后我的mySql表正确记录访问;
  • 如果我发送邮件,然后我从eudora桌面打开它,从浏览器打开outlook.com,从Android打开outlook应用程序,那么mySql没有记录访问。

我的问题是:

  • 我做错了什么?
  • 可能是邮件服务器(Zoho)下载了img并将其嵌入到html邮件中,所以没有客户端下载它?

几乎所有的电子邮件客户端都删除了图像,因为它们被用来跟踪用户。