开发者

Sending Text and HTML Emails - Why is Gmail Always Picking Text Version?

I'm sending some emails from my ASP.NET MVC application, using ActionMailer.NET.

Now, part of this process is sending both HTML and text versions of the message, to support text-only clients.

But what i'm seeing is that GMail is always picking the text version.

I tried Yahoo, and Yahoo is picking the HTML version correctly.

I tried dumbing down my HTML to nothing but a <h1> and a <span> tag, and GMail still picked the text version, which means there isn't a problem with the content of the HTML.

Is this expected behaviour?

Because when i send only the HTML version, GMail will show the HTML version correctly.

I've set the meta-tags in the HTML as follo开发者_如何转开发ws:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Has anyone else encountered this behaviour, and found a solution?

Because as it stands, i'll probably have to send only the HTML version, so that GMail will render it, as too many of our clients use GMail.

Here's an example of basic HTML i'm trying to send:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title></title>
    </head>
    <body>
        <h1>This is the heading</h1>
        <span>This is some text.</span>
    </body>
</html>

And GMail won't even allow that.


Most web-based clients and desktop email clients ignore anything in the <head> tag of an email.

To send both html and text versions, you will need to construct the mail message properly - have two mime chunks.

Show us the full code you are using to construct your email.


I guess the first thing i should have checked is the ActionMailer.NET issues.

I did some Googling, and it didn't come up.

This issue was fixed 2 days ago, so getting the latest package fixed the problem.

https://bitbucket.org/swaj/actionmailer.net/issue/23/multipart-mail-problem

That issue was actually relating to Thunderbird, but guess GMail has a similar way of handling multipart emails.

Problem solved!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜