Postupuji podle tohoto návodu
http://www.thinkdope.com/web-design-development/track-email-opens-php/
Vše je jasné, akorát já nemám soubor se skriptem, ale veškerý kód je v metodě:
public function trackImage($campaignId) {//file or function?
$logo = WWW_DIR . '\images\image.jpg'; // Set image Full Path
$etag = md5_file($logo);
$lastModified = gmdate('D, d M Y H:i:s', filemtime($logo)) . ' GMT';
$language = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$ip = $this->getUserIpAddr();
header('Content-Type: image/jpg'); // Change image type if you use gif/jpg
header('Content-Disposition: inline; filename="image.jpg"'); // Image name
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($logo));
header('Accept-Ranges: bytes');
header('ETag: "' . $etag . '"');
header('Last-Modified: ' . $lastModified);
readfile($logo);
if (!is_null($lastModified) || !is_null($ip)) {
$insert = array('open' => $lastModified, 'language' => $language, 'ip' => $ip, 'campaign_id' => $campaignId);
$this->insertTrack($insert);
}
}
Jak mám upravit src tag, aby to fungovalo i s tou metodou?
<img src="http://example.com/emailtracker.php?to=recipient@example.com" alt="" />