Mail multipart/alternative vs multipart/mixedへの答えは、添付ファイルのように、multipart/alternative
メッセージの仲間であることを示唆している:HTML、電子メール、画像、プレーンテキストを満たすMIMEタイプ?
- マルチパート/混合
- マルチパート/代替
- text/plainの
- text/htmlの
- OME /もの(処分:添付ファイル)
- いくつか/事:私はいくつかのインライン画像でHTML部分とのメールを送信したいのですが(処分添付)
- ...
- マルチパート/代替
とプレーンテキスト代替。さまざまなパーツに適したMIMEレイアウトは何ですか?いくつかのオプションがサンプルコードやその他の質問に表示されますが、実際にはうまくいっていますか?
- マルチパート/代替
-
- テキスト/ HTML(CIDによって画像を参照)に関連するマルチパート/
- 画像/ GIF
- text/plainの:私の傾きはこれです
- image/gif
- ...
-
こうすることで、画像はHTML部分をレンダリングする目的のために明確にしています。これの完全な例は次のようになります:
From: Rich Example <[email protected]>
To: A Recipient <[email protected]>
Subject: An example of email with images and a plain alternative
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="outer-boundary"
This is a MIME-encoded message. If you are seeing this, your mail
reader is old.
--outer-boundary
Content-Type: text/plain; charset=us-ascii
This message might make you :) or it might make you :(
--outer-boundary
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html"; start="<[email protected]>"; boundary="inner-boundary"
--inner-boundary
Content-Type: text/html; charset=us-ascii
Content-Disposition: inline
Content-ID: <[email protected]>
<html>
<body>
This message might make you
<img src="cid:[email protected]" alt="smile">
or it might make you
<img src="cid:[email protected]" alt="frown">
</body>
</html>
--inner-boundary
Content-Type: image/gif
Content-Disposition: inline
Content-Transfer-Encoding: base64
Content-ID: <[email protected]>
R0lGODlhEAAQAKEBAAAAAP//AP//AP//ACH5BAEKAAIALAAAAAAQABAAAAIzlA2px6IBw2
IpWglOvTahDgGdI0ZlGW5meKlci6JrasrqkypxJr8S0oNpgqkGLtcY6hoFADs=
--inner-boundary
Content-Type: image/gif
Content-Disposition: inline
Content-Transfer-Encoding: base64
Content-ID: <[email protected]>
R0lGODlhEAAQAKEBAAAAAAD//wD//wD//yH5BAEKAAIALAAAAAAQABAAAAIzlA2px6IBw2
IpWglOvTahDgGdI0ZlGW5meKlci75drDzm5uLZyZ1I3Mv8ZB5Krtgg1RoFADs=
--inner-boundary--
--outer-boundary--
質問の正確なdupeのように見える:http://stackoverflow.com/questions/3902455/smtp-multipart-alternative-vs-multipart-mixed –
意図のわずかな違い(私がそれを明確に伝えたかどうかそれとも添付ファイルの目的に関係するかもしれない)。リッチレンダリング(例:ロゴ、ウィングディングなど)の場合、それらが豊富な代替手段の「中」にあるべきか?また、ref'd質問は '関連'の言及もしていない。 –