【发布时间】:2013-11-05 06:29:54
【问题描述】:
为了跟踪电子邮件打开率,我在从我的服务器发送的大量电子邮件中触发了一个像素。该脚本在 Mac Mail 中运行。收到电子邮件并下载像素。
但是,它在 Yahoo 邮件客户端中不起作用。收到电子邮件,下载并显示引用的图像,但是像素不会触发/下载,php 脚本也不会运行(据我所知)。有谁知道为什么雅虎邮件客户端和我尚未测试的其他潜在客户端会发生这种情况?
这里是html的img标签:
<img src="http://mysite.com/email_track.php?email=email_value&country=country_value&state=state_value" />
这是 php 脚本:
<?php
// Database code omitted
$result= mysql_query("INSERT INTO `CelebrationOpens` SET `time` = NOW(), `country` = '$country', `state` = '$state', `email` = '$email' ") or die(mysql_error());
// Create an image, 1x1 pixel in size
$im=imagecreate(1,1);
// Set the background colour
$white=imagecolorallocate($im,255,255,255);
// Allocate the background colour
imagesetpixel($im,1,1,$white);
// Set the image type
header("content-type:image/jpg");
// Create a JPEG file from the image
imagejpeg($im);
// Free memory associated with the image
imagedestroy($im);
?>
我也尝试过像这样触发像素:
$name = './concert/pixel.png';
$fp = fopen($name, 'rb');
header("Content-Type: image/png");
header("Content-Length: " . filesize($name));
fpassthru($fp);
exit;
【问题讨论】:
-
图像拦截器是我的猜测。除非用户接受图像,否则许多/大多数电子邮件程序可以阻止图像。
-
@Class 我认为这是不可能的,因为电子邮件中显示了其他图像。我将编辑我的问题以澄清这一点。
-
我首先要检查的是您的网络服务器日志。如果其他图像下载正常,那么您的 Web 服务器日志将包括它们的命中。日志是否还包括跟踪像素的命中?如果不是,那么客户端永远不会请求它。如果是,那么返回状态是否为 200?
-
@AlexHowansky 如果我使用 imagecreate() 函数创建图像,该图像在日志中的名称是什么?
-
也许他们正在缓存像素图像?使用
curl --head http://...访问像素 URL,查看它发送的标头。
标签: php email html-email yahoo