Apple Mail 7.0中嵌入的高DPI图像的奇怪行为

时间:2013-10-30 18:43:06

标签: email retina apple-mail highdpi

我遇到了一个问题,即使使用width属性,图像也会以原始大小显示:

这是我的测试html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<title>test</title>
</head>
<body>

    <div>
        <p>Embeded 1</p>
        <img src="embeded400x200.png" alt="" width="200" height="100" />
        <img src="embeded400x200.png" alt="" width="200" height="100" />
        <img src="embeded200x100.png" alt="" width="200" height="100" />
        <img src="embeded200x100.png" alt="" width="200" height="100" />
    </div>
    <div>
        <p>Embeded 2</p>
        <img src="embeded400x200.png" alt="" width="200" height="100" />
        <img src="embeded400x200.png" alt="" width="200" height="100" />
        <img src="embeded200x100.png" alt="" width="200" height="100" />
        <img src="embeded200x100.png" alt="" width="200" height="100" />
    </div>
    <div>
        <p>Linked 1</p>
        <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
    </div>
    <div>
        <p>Linked 2</p>
        <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
    </div>

</body>
</html>

以下是Apple Mail 7.0的截图

enter image description here

修改 这是原始电子邮件正文:

Received: from [xxx] (helo=xxx)
    by xxx with esmtp (Exim 4.68)
    (envelope-from <xxx>)
    id 1VfX9Z-0002AE-Ki; Sun, 10 Nov 2013 16:42:21 +0100
Return-path: <xxx>
X-Envelope-To: xxxx
Received: from [xxx] (helo=xxx)
    by xxx with esmtp (Exim 4.68)
    (envelope-from <xxxx>)
    id 1VfX9Z-0004By-IS
    for xxx; Sun, 10 Nov 2013 16:42:21 +0100
Received: from [xxxx] (helo=xxx)
    by xxx with esmtpa (Exim 4.68)
    (envelope-from <xxx>)
    id 1VfX9Z-0007f1-4u
    for xxx; Sun, 10 Nov 2013 16:42:21 +0100
Received: by xxx (Postfix, from userid 501)
    id CF8EA3B8AA0A; Sun, 10 Nov 2013 16:42:20 +0100 (CET)
To: xxx
Subject: xxx
Date: Sun, 10 Nov 2013 15:42:20 +0000
From: xxx <xxx>
Message-ID: <xxx>
X-Priority: 3
X-Mailer: revaxarts-themes demo
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="b1_e1c39bd3cc07c9a37a6ae66b52e2753d"
Content-Transfer-Encoding: 8bit
X-Df-Sender: eGF2ZXJAcmV2YXhhcnRzLmNvbQ==
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
    spamfilter16.ispgateway.de
X-Spam-Level: 
X-Spam-Status: No, hits=0.0 required=9999.0 tests=BAYES_50 autolearn=disabled
    version=3.3.1
X-Spam-CMAETAG: v=1.1 cv=eqI3rwYZn7zV4UmkNMmt7weZSwHui2Vc5AUAV4IajoU=
    c=1 sm=0 a=um-k4-9LFHQA:10 a=FP3bJtu2gI4vAIHRqdwASw==:17
    a=RELTunctmil-TFG8TWAA:9 a=QEXdDO2ut3YA:10 a=ezkJIM3X4EQA:10
    a=_5yxvZR9Ds0A:10 a=SSmOFEACAAAA:8 a=1hle9SxZAAAA:8
    a=PTYHS11jASYzloMs0H4A:9 a=_W_S_7VecoQA:10 a=p403mkujtbAA:10
    a=jbmgarMCn3JHYSELxa8A:9 a=HXjIzolwW10A:10 a=_moxOrh7Pwr-ZIKs:18
    a=yE_UcD7gtxtlVJ_mbRcA:9 a=nDhcKlyyXGP8reDK:18
    a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 xcat=Undefined/Undefined
X-Spam-CMAECATEGORY: 0
X-Spam-CMAESUBCATEGORY: 0
X-Spam-CMAESCORE: 0

--b1_e1c39bd3cc07c9a37a6ae66b52e2753d
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Embeded 1

Embeded 2

Linked 1

Linked 2


--b1_e1c39bd3cc07c9a37a6ae66b52e2753d
Content-Type: multipart/related;
    boundary="b2_e1c39bd3cc07c9a37a6ae66b52e2753d"

--b2_e1c39bd3cc07c9a37a6ae66b52e2753d
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>test</title>
    </head>
    <body>

        <div>
            <p>Embeded 1</p>
            <img src="cid:110e4c63bcdb73309ff786e1f8a5e8fb@phpmailer.0" alt="" width="200" height="100" />
            <img src="cid:110e4c63bcdb73309ff786e1f8a5e8fb@phpmailer.0" alt="" width="200" height="100" />
            <img src="cid:896b1e037817a7de25fbdb672ea7d63a@phpmailer.0" alt="" width="200" height="100" />
            <img src="cid:896b1e037817a7de25fbdb672ea7d63a@phpmailer.0" alt="" width="200" height="100" />
        </div>
        <div>
            <p>Embeded 2</p>
            <img src="cid:110e4c63bcdb73309ff786e1f8a5e8fb@phpmailer.0" alt="" width="200" height="100" />
            <img src="cid:110e4c63bcdb73309ff786e1f8a5e8fb@phpmailer.0" alt="" width="200" height="100" />
            <img src="cid:896b1e037817a7de25fbdb672ea7d63a@phpmailer.0" alt="" width="200" height="100" />
            <img src="cid:896b1e037817a7de25fbdb672ea7d63a@phpmailer.0" alt="" width="200" height="100" />
        </div>
        <div>
            <p>Linked 1</p>
            <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
            <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
            <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
            <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
        </div>
        <div>
            <p>Linked 2</p>
            <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
            <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
            <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
            <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
        </div>

    </body>
    </html>


--b2_e1c39bd3cc07c9a37a6ae66b52e2753d
Content-Type: image/png; name="embeded400x200.png"
Content-Transfer-Encoding: base64
Content-ID: <110e4c63bcdb73309ff786e1f8a5e8fb@phpmailer.0>
Content-Disposition: inline; filename=embeded400x200.png

iVBORw0KGgoAAAANSUhEUgAAAZAAAADIBAMAAAA0O6rRAAAAG1BMVEUAAAD/Dw4fAQF/BwefCQi/
CwpfBQXfDQw/AwOUadmkAAAFS0lEQVR4nO2YzVPjRhDFhSwbHXfA2BwNIUWO6yxJrtZCsntESXYr
R1z54mizpMhRJrsu/9k7PdMj9VgjQcmHpFLvV5SR26+lfqP5kqIIAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAADwHL4pWn7sz54fJb66nZTH8foxoIg3TRKZ24XspuXHk8Vz
ovlLruuNUuPXHDxbKnUvSusd0ufHZYPEy+3E7kZ6amYPpuryVaZecnD46kIdVqq9A/3xnTq6vMjV
T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dZ
pbEXjkr4wYptmvHtNk9GKpfDefkULyVebhui69WMXJdFVio3MGh7GI7WjTQ/6q6qETyoXi90etQV
00bNiG2i8wNPZZsrpu1hOFo30vzyQXT8aXVzOr186FW9tGbEVkdbLqGyi9Y5bQ/D0YCRptdBYrpI
7AOcddDpdVD+oxGGjPw+MleYeKrkSH9PH8ywDkfrRhJTxtzORuZGD8yrO7Ec5nciTUj83DYS9X6z
+Y3Krxl5zD/oX+58VZQNb9f537RdbojWjUTT8eWvb8pXpvffXiyNhWr/lKi/yoXZk/i5rXyiyf6n
KGCkGORKfdhSRYMlBW3J4WjdSJpp3VsOftTHw8LUOKuMMKMtyVZuK+kfja/t4/VtXRWvN4FcGQ2w
uS2qJCeVy+FWTfJsMvc/SXr5b1cAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAD8r/kMq7dYR24m8s8AAAAASUVORK5CYII=


--b2_e1c39bd3cc07c9a37a6ae66b52e2753d
Content-Type: image/png; name="embeded200x100.png"
Content-Transfer-Encoding: base64
Content-ID: <896b1e037817a7de25fbdb672ea7d63a@phpmailer.0>
Content-Disposition: inline; filename=embeded200x100.png

iVBORw0KGgoAAAANSUhEUgAAAMgAAABkBAMAAAAxqGI4AAAAG1BMVEUAAAD/Dw4/AwN/BwefCQgf
AQFfBQXfDQy/CwqPUrJGAAACKUlEQVRoge2UO2/iQBSFD37hkmYfpRW0CaUVJ4gSsWiX0lsQtrSi
RHGJggiUFnGIf/beO+O3kRJlt1npfhIH+9zRnJk7IwOCIAiCIAiCIAiCIAjCv8SZ1t+MpHwcsdws
Ug+wJ5XSGNZLtO2Ph2y+3TwBF/eVAv0Q+L1B2/54CLECHknDXFXBeArQtv8qxPVMGmJOtZJxAB7C
QL/U7DbG1TVs7y6yg4hChmOyht9pNcMxhXARRhBVIa5HnV9r1eu4RsCFut1hfvbgmZPb+ejsGc58
NtzCmp0/wjqeHxNVxOI2jvPB/ZAPAVutgBWxG+izqew2tDt7bX5C/4Ua7nwGYlxx72naVaKKTgJ7
X7atx39breqMdEjTbsPhB5rM9emR5iPd8u6p2U6iityDYicHPdtBq5q+FlLanRD6jU2fN+6GfPCW
R001owE3XBV7KA+eFtOcbfu+kF9Zlm0aIfdfs+zVVyGqWAuJW33Jb+Ob7VJdbYao66FCVLEKcV70
NcJAqz5uFLertDv02iGuN8jXYySqyDPpkJieLJ8LWnGHIqRhd1CXsAxZ89Z+sE9iJarIslBLoY3A
oCFupLVof9CyO9j0JQjLkBQ4YuXB5q9DnKiiTb3PeOgcuU5yLRYdNO0TjNLFtAyZpT99GNk8hbFf
XCaqiIv0mdvlfNntdhHM/Ss1VakVVSE1+xTL+hfN5hd7WTzp4rK597BQ97QtCIIgCIIgCIIgCMJ/
yR8xnoWK3AkfWgAAAABJRU5ErkJggg==


--b2_e1c39bd3cc07c9a37a6ae66b52e2753d--


--b1_e1c39bd3cc07c9a37a6ae66b52e2753d--

图像嵌入phpMailer,因此源可能看起来略有不同,但宽度属性仍将保留。

只有第一个嵌入图片受到影响

did a testrun with Litmus和所有其他邮件按预期工作。甚至是Apple Mail 5Apple Mail 6

这是Apple Mail中的错误还是我错过了什么?

2 个答案:

答案 0 :(得分:1)

您的HTML无效,请使用validation tool修复错误。特别是你的两个div没有关闭,也不会过去。

我自己邮寄了固定版本,并在苹果邮件(版本7)中阅读,没有任何问题,所以这将解决您的问题,或者您需要附加您正在使用的实际PHPmailer代码或其实际生成的HTML。

这是您的XHTML的有效版本:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>mail subject</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
</head>
<body>
    <div>
        <p>Embeded 1</p>
        <img src="embeded400x200.png" alt="" width="200" height="100" />
        <img src="embeded400x200.png" alt="" width="200" height="100" />
        <img src="embeded200x100.png" alt="" width="200" height="100" />
        <img src="embeded200x100.png" alt="" width="200" height="100" />
    </div>
    <div>
        <p>Embeded 2</p>
        <img src="embeded400x200.png" alt="" width="200" height="100" />
        <img src="embeded400x200.png" alt="" width="200" height="100" />
        <img src="embeded200x100.png" alt="" width="200" height="100" />
        <img src="embeded200x100.png" alt="" width="200" height="100" />
    </div>
    <div>
        <p>Linked 1</p>
        <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
    </div>
    <div>
        <p>Linked 2</p>
        <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/200x100/000/fff&amp;text=linked+200/100" alt="" width="200" height="100" />
        <img src="http://dummyimage.com/400x200/000/fff&amp;text=linked+400/200" alt="" width="200" height="100" />
    </div>
</body>
</html>

答案 1 :(得分:1)

我意识到这已经有一年了,但在搜索时无法找到解决方案。我们遇到了类似的问题(特别是在Apple Mail 7和8中),并且在img标签上使用内联CSS已经解决了这个问题。

e.g。而不是:

<div>
    <p>Embeded 1</p>
    <img src="embeded400x200.png" alt="" width="200" height="100" />
    <img src="embeded400x200.png" alt="" width="200" height="100" />
    <img src="embeded200x100.png" alt="" width="200" height="100" />
    <img src="embeded200x100.png" alt="" width="200" height="100" />
</div>

使用:

<div>
    <p>Embeded 1</p>
    <img src="embeded400x200.png" alt="" style="width:200px;height:200px" width="200" height="100" />
    <img src="embeded400x200.png" alt="" style="width:200px;height:200px" width="200" height="100" />
    <img src="embeded200x100.png" alt="" style="width:200px;height:200px" width="200" height="100" />
    <img src="embeded200x100.png" alt="" style="width:200px;height:200px" width="200" height="100" />
</div>