0

大量の画像を埋め込んだメールを送信するサービスを作成しています。また、これらの画像は、Chrome やその他のブラウザーを使用する gmail Web クライアントでランダムに失われることがよくあります (添付のスクリーンショットを参照)。画像が正しく送信されていると確信しています。画像は電子メールに添付され、欠落した画像は Chrome のコンテキスト メニューを使用して正常にダウンロードできます。ctrl+F5 を押すと、画像が表示されます (または他の画像が消えます)。また、これらのメールは Thunderbird または MS Outlook で正常に表示されています。

これが私のChromeのスクリーンショットです:

ここに画像の説明を入力

この問題を回避するために、メール本文を変更する方法 (ヘッダーを追加するなど) についてアドバイスをお願いします。

外部画像 ( など<img src="http://mydomain/img.png">) の使用は好ましくありません。のような埋め込み画像のみ<img src="cid:img.png">

E メールは、Amazon Web Services のメール送信者を介して送信されています。また、画像を送信するためにjavamailを使用しています。

メール本文のサンプルは次のとおりです。

Return-Path: <0000014117bed1a2-aad7fbff-afdd-43ea-a658-825a817e9903-000000@amazonses.com>
Received: from a8-83.smtp-out.amazonses.com (a8-83.smtp-out.amazonses.com. [54.240.8.83])
        by mx.google.com with ESMTP id nd18si8517742qeb.113.1969.12.31.16.00.00;
        Fri, 13 Sep 2013 08:36:38 -0700 (PDT)
Received-SPF: pass (google.com: domain of 0000014117bed1a2-aad7fbff-afdd-43ea-a658-825a817e9903-000000@amazonses.com designates 54.240.8.83 as permitted sender) client-ip=54.240.8.83;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of 0000014117bed1a2-aad7fbff-afdd-43ea-a658-825a817e9903-000000@amazonses.com designates 54.240.8.83 as permitted sender) smtp.mail=0000014117bed1a2-aad7fbff-afdd-43ea-a658-825a817e9903-000000@amazonses.com
Return-Path: 0000014117bed1a2-aad7fbff-afdd-43ea-a658-825a817e9903-000000@amazonses.com
From: <my service email here>
Sender: <my service email here>
To: <my receiver email here>
Message-ID: <0000014117bed1a2-aad7fbff-afdd-43ea-a658-825a817e9903-000000@email.amazonses.com>
Subject: =?UTF-8?Q?RedHelper_-_=D0=BF?=
 =?UTF-8?Q?=D0=BB=D0=B0=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9?=
 =?UTF-8?Q?_=D0=BE=D1=82=D1=87=D1=91=D1=82_?=
 =?UTF-8?Q?(c_06.09.2013_=D0=BF=D0=BE_12.09.2013)?=
MIME-Version: 1.0
Content-Type: multipart/related; 
    boundary="----=_Part_0_68348157.1379082638282"
Date: Fri, 13 Sep 2013 14:34:43 +0000
X-SES-Outgoing: 2013.09.13-54.240.8.83

------=_Part_0_68348157.1379082638282
Content-Type: text/html;charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0

<table width=3D"750" align=3D"center" bgcolor=3D"#f2f4e6" cellpadding=3D"0"=
 cellspacing=3D"0"
=09   style=3D"
=09   =09=09border-collapse: collapse;
=09   =09=09font-family: arial, sans-serif;
=09   =09=09color: #374550;
=09   =09=09font-size: 14px;
=09   =09=09">
=09<tr>
=09=09<td>
=09=09=09<img src=3D"cid:client_report_header.png" alt=3D"RedHelper - =D0=
=BF=D0=BB=D0=B0=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9 =D0=BE=D1=82=D1=87=D1=91=D1=
=82" width=3D"750" height=3D"124"/>

...........................
The rest of email body
...........................

------=_Part_0_68348157.1379082638282
Content-Type: image/png; name=client_report_header.png
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename=client_report_header.png
Content-ID: <client_report_header.png>
X-Attachment-Id: client_report_header.png

...........................
base64 encoded image
...........................
...........................
then a lot of other images
...........................

この問題を解決するのを手伝ってください、私はそれで行き詰まっています:(

アップデート:

ブラウザが埋め込み画像に対して行うリクエストを調べたところ、gmail 添付ファイル サービスが間違った応答ヘッダーを返すことがあり (たとえば、image/png ではなく text/html タイプで)、画像が表示されないことがわかりました。

「良い」応答ヘッダーの例を次に示します (Chrome 開発者ツールからコピー):

Request URL:https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=da16498049&view=att&th=141543ec8afd95ce&attid=0.49&disp=emb&zw&atsh=1&saduie=AG9B_P_B99tk3pnLfQHlDF_gPQKM&sadet=1380097953720&sads=D0OzbnmhqzBZ6htOe0o3RTWuwvw
Request Method:GET
Status Code:200 OK

Request Headers
:host:mail-attachment.googleusercontent.com
:method:GET
:path:/attachment/u/0/?ui=2&ik=da16498049&view=att&th=141543ec8afd95ce&attid=0.49&disp=emb&zw&atsh=1&saduie=AG9B_P_B99tk3pnLfQHlDF_gPQKM&sadet=1380097953720&sads=D0OzbnmhqzBZ6htOe0o3RTWuwvw
:scheme:https
:version:HTTP/1.1
accept:image/webp,*/*;q=0.8
accept-encoding:gzip,deflate,sdch
accept-language:en-US,en;q=0.8,ru;q=0.6
cookie:S=gmail=QQ8uQOaAEhQ4x5TFVYcQhg
referer:https://mail.google.com/mail/u/0/
user-agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36
x-chrome-variations:CK61yQEIhrbJAQiqtskBCMS2yQEIt4XKAQjxhsoB

Response Headers
access-control-allow-credentials:true
alternate-protocol:443:quic
cache-control:private, max-age=86400
content-disposition:attachment; filename="visitors_capture_pic.png"
content-length:4336
content-type:image/png
date:Wed, 25 Sep 2013 08:32:14 GMT
server:GSE
status:200 OK
version:HTTP/1.1
x-content-type-options:nosniff
x-xss-protection:0

そして、「悪い」応答ヘッダーの例を次に示します。

Request URL:https://mail-attachment.googleusercontent.com/attachment/u/0/?ui=2&ik=da16498049&view=att&th=141543ec8afd95ce&attid=0.5&disp=emb&zw&atsh=1&saduie=AG9B_P_B99tk3pnLfQHlDF_gPQKM&sadet=1380097948083&sads=37LZqateabeXb45jYSk9ooGybwI
Request Method:GET
Status Code:200 OK

Request Headers
:host:mail-attachment.googleusercontent.com
:method:GET
:path:/attachment/u/0/?ui=2&ik=da16498049&view=att&th=141543ec8afd95ce&attid=0.5&disp=emb&zw&atsh=1&saduie=AG9B_P_B99tk3pnLfQHlDF_gPQKM&sadet=1380097948083&sads=37LZqateabeXb45jYSk9ooGybwI
:scheme:https
:version:HTTP/1.1
accept:image/webp,*/*;q=0.8
accept-encoding:gzip,deflate,sdch
accept-language:en-US,en;q=0.8,ru;q=0.6
cookie:S=gmail=QQ8uQOaAEhQ4x5TFVYcQhg
referer:https://mail.google.com/mail/u/0/
user-agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.76 Safari/537.36
x-chrome-variations:CK61yQEIhrbJAQiqtskBCMS2yQEIt4XKAQjxhsoB

Response Headers
alternate-protocol:443:quic
cache-control:no-cache, no-store, max-age=0, must-revalidate
content-encoding:gzip
content-type:text/html; charset=UTF-8
date:Wed, 25 Sep 2013 08:32:09 GMT
expires:Fri, 01 Jan 1990 00:00:00 GMT
pragma:no-cache
server:GSE
status:200 OK
version:HTTP/1.1
x-content-type-options:nosniff
x-frame-options:SAMEORIGIN
x-xss-protection:1; mode=block

次に、欠落している画像を別のブラウザ ページでダウンロードしようとすると、3 つの「302 Moved Temporarily」リクエストが表示され、最後に「200 OK」が表示されて画像が表示されます。

4

0 に答える 0