开发者

Outlook shows HTML as TEXT

I send email from my ruby on rails app. All email clients display fine my email (gmail, the bat, thunderbird etc) but not Outlook :(

In outlook i see this:

my message text

--mimepart_4e514d8786c25_d59..fdab8042069c
Content-Type: multipart/related; charset=f-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

--mimepart_4e514d8786c25_d59..fdab8042069c
Content-Type: text/plain; charset=f-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

my email text message

--mimepart_4e514d8786c25_d59..fdab8042069c
Content-Type: text/html; charset=f-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

my email html code (<h1>test</h1><table...)

--mimepart_4e514d8786c25_d59..fdab8042069c--

Whats wrong???

Just in case headers from outlook:

Message-Id: <4e514d88.100fdf0a.403c.31a7@mx.xxx.ccc>
Subject: =?utf-8?Q?=D0=97=D0=B0=D0=BF=D1=80=D0=BE=D1=81_=D0=B4=D0=BB=D1开发者_JS百科=8F_=D0=BC=D0=B5=D0=BD=D0=B5=D0=B4=D0=B6=D0=B5=D1=80=D0=B0_=D0=BA=D0=BE=D0=BC=D0=BF=D0=B0=D0=BD=D0=B8=D0=B8_?=
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=mimepart_4e514d8786c25_d59..fdab8042069c
User-Agent: Rails Application
X-Mailer: Rails Mailer
Return-Path: admin@xxx.ccc
X-Yandex-Forward: 8a20ef6ffc7eeb7ef7c8d000508718e0

The same email from gmail, where all display good both for text and html mode:

Delive
Message-Id: <4e514d88.100fdf0a.403c.31a7@mx.xxx.com>
Subject: xxx
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=mimepart_4e514d8786c25_d59..fdab8042069c
User-Agent: Rails Application
X-Mailer: Rails Mailer
X-Yandex-Forward: 8a20ef6ffc7eeb7ef7c8d000508718e0


--mimepart_4e514d8786c25_d59..fdab8042069c
Content-Type: multipart/alternative; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

email text 


--mimepart_4e514d8786c25_d59..fdab8042069c
Content-Type: multipart/related; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline


--mimepart_4e514d8786c25_d59..fdab8042069c
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

email text (plain text)

--mimepart_4e514d8786c25_d59..fdab8042069c
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline


email text(html)

--mimepart_4e514d8786c25_d59..fdab8042069c--


How did you construct this mail? Did you add the headers manually?

I don't know where that charset=f-8 comes from, but it's a bug and it renders that whole header line containing the Content-Type: text/html part invalid. You just got lucky the other mail clients didn't feel like being very strict there.

The invalid header line causes Outlook to interpret the part as plain text, which is rather sensible.

If you didn't add those headers manually, and ActionMailer got cheeky in stead, please post some of the code where you construct the mail. Might be worth posting another question.


(1) multipart structuring in your sample is wrong; you need to achieve hierarchy like this (with proper transfer encoding and other details):

Content-Type: multipart/alternative; boundary="LEVEL0"

--LEVEL0
Content-Type: text/plain; ...
email text...

--LEVEL0
Content-Type: multipart/related; boundary="LEVEL1"

--LEVEL1
Content-Type: text/html; ...
<html><body>...

--LEVEL1
Content-Type: image/jpeg; ...
...

--LEVEL1--

--LEVEL0--

(2) Some Outlook versions will not display HTML message directly when Content-Disposition: inline header is explicitly set for "text/html" part of it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜