HTML email

J

Jeff Thies

It seems like I have to write an HTML formatted email (and I'm a
plain text guy!). So apart from the politics of this, what needs to go
in an HTML email?

It appears to me that if the html, body and head tags are optional for a
web page they probably aren't needed in HTML email either. Page titles
would certainly be useless!

So, I'm thinking.

A content-type, doctype and a stylesheet and then html, nothing else...
Or is there a reason to have all that extra baggage?

Jeff
 
T

Toby Inkster

Jeff said:
It appears to me that if the html, body and head tags are optional for a
web page they probably aren't needed in HTML email either. Page titles
would certainly be useless!

Almost useless, but still required. Their use would be to e-mail clients
that can't process HTML directly but launch the page in a browser.
A content-type, doctype and a stylesheet and then html, nothing else...

Do you need to embed images? If so, it gets a *lot* more complicated.
 
D

David Dorward

Jeff said:
A content-type,

Several content types - you need, at least, a plain text alternative but
possibly also images.

<head> said:
and a stylesheet

Stylesheets and many email clients do not mix nicely. This is one instance
where it is better to resport to inline style.
and then html, nothing else...
Or is there a reason to have all that extra baggage?

Spam filters really hate HTML email without a plain text alternative. So do
people who use email clients which don't support HTML formatted email.
 
J

Jeff Thies

David said:
Jeff Thies wrote:




Several content types - you need, at least, a plain text alternative but
possibly also images.

Lets say I'm going to do a multipart, not that I really want to. It
looks this way to me:

Content-Type: multipart/alternative;
boundary=--some_long_random_string

--some_long_random_string

Content-Type: text/plain; charset=ISO-8859-1

.... plaint text message ...

--some_long_random_string

Content-Type: text/html; charset=ISO-8859-1

--some_long_random_string

Is there something else needed and are there any rules for that message
seperator string?

In HTML the <html>, <head>, and <body> tags are optional (the elements
aren't, but they are implied)




Stylesheets and many email clients do not mix nicely. This is one instance
where it is better to resport to inline style.

Lovely! I've just looked through some html message sources and I see
that they are largely tag soup!
Spam filters really hate HTML email without a plain text alternative. So do
people who use email clients which don't support HTML formatted email.
OK, so how do I get out of this cleanly? If I do a plain text
alternative do I still have to abandon a stylesheet?

Jeff
 
J

Jeff Thies

Toby said:
Jeff Thies wrote:




Almost useless, but still required. Their use would be to e-mail clients
that can't process HTML directly but launch the page in a browser.

Which mail clients don't support HTML email directly? How large of the
market is that?
Do you need to embed images? If so, it gets a *lot* more complicated.

Nope, just the usual shopping cart reprise. Client has paper design
skills and specifically requested HTML emails. I'm not thrilled about
putting together a multipart mixed mime type message.

See reply to David about questions about putting together a text
alternative email.

Jeff
 
T

Toby Inkster

Jeff said:
Lets say I'm going to do a multipart, not that I really want to. It
looks this way to me:

Content-Type: multipart/alternative;
boundary=--some_long_random_string

--some_long_random_string

Content-Type: text/plain; charset=ISO-8859-1

... plaint text message ...

--some_long_random_string

Content-Type: text/html; charset=ISO-8859-1

--some_long_random_string

Is there something else needed and are there any rules for that message
seperator string?

IIRC, the last boundary at the very end ought to have another '--'
appended to it.

There are rules for the boundary. Stil to alphanumerics and you'll be OK.
One rule of course is that the boundary should not appear in the real data
anywhere!

See the MIME RFCs for more details. IIRC OTTOMH it's RFC 2045 et al.
 
T

Toby Inkster

Jeff said:
Which mail clients don't support HTML email directly? How large of the
market is that?

Becky2 doesn't. (Although IIRC it has an option to embed an Internet
Explorer control -- this is switched off by default for security reasons)
Mutt doesn't (most Mutt users pipe HTML messages through "lynx -dump"),
Sylpheed didn't last time I used it (though there was a patch that allowed
it to embed a Dillo control to render HTML). Don't think PINE does. Et
cetera, et cetera.
 
D

David Dorward

Jeff said:
--some_long_random_string

Is there something else needed and are there any rules for that message
seperator string?

I suggest finding a prewritten MIME library for whatever you are producing
the email with. That saves having to worry about reinventing the wheel.
Lovely! I've just looked through some html message sources and I see
that they are largely tag soup!

Most webpages are largely tag soup :)

It is prossible to produce reasonable HTML for emails... the style
attributes just make it a tad messy.
OK, so how do I get out of this cleanly? If I do a plain text
alternative do I still have to abandon a stylesheet?

The plain text alternative is for email clients which can't cope with HTML
formatted mail at all.

Many email clients which do support HTML formatted mail (such as, IIRC, the
Hotmail and Yahoo! Mail web interfaces) strip the <head> section off
entirely, thus losing any <style> or <link> elements. So if you want it to
be pretty you either have to use inline style, or deprecated markup (and
abuse tables etc).
 
K

Karl Groves

David Dorward said:
Jeff Thies wrote:

Stylesheets and many email clients do not mix nicely. This is one instance
where it is better to resport to inline style.

IIRC, the only CSS that gets you in trouble with e-mail clients is rather
advanced layout stuff.
If you need to do webpage-like layout in the HTML email, this is one place
where tables are definitely preferred.

-Karl
 
K

Karl Groves

Jeff Thies said:
Toby Inkster wrote:

Which mail clients don't support HTML email directly? How large of the
market is that?

I think the incidence of people who have this feature turned off is a factor
that can be at least as important as those whose client does not support it.
It all depends on your target audience. If your target audience people who
work for the US Government or defense industry (like mine) then there will
be a lot of people whose IT department mandates that they do not accept HTML
email. If your target audience is people at home, then it will only be a
very small number of people who can't support it.

Regardless, always offer a text alternative when users subscribe to the
newsletter (this is an opt-in thing, isn't it?)

-Karl
 
W

WebcastMaker

Which mail clients don't support HTML email directly? How large of the
market is that?

none of them do if the user doesn't want it to. How large a market?
Good guess would be that it is equally as large as the percentage that
does not have javascript turned on. That ranges anywhere from 10%-20%
depending on who you ask.
 
W

WebcastMaker

If you need to do webpage-like layout in the HTML email, this is one place
where tables are definitely preferred.

Chest hurting.... difficulty in breathing... (clutching chest...)
 
J

Jeff Thies

Many email clients which do support HTML formatted mail (such as, IIRC, the
Hotmail and Yahoo! Mail web interfaces) strip the <head> section off
entirely, thus losing any <style> or <link> elements. So if you want it to
be pretty you either have to use inline style, or deprecated markup (and
abuse tables etc).

Hmmmm.

I'm taking html that has already been formatted elsewhere and reprising
it. Most concerned with: border-collapse: collapse and maybe a font
issue or two. BTW, this is naturally tabular data (order form).

Seems to me that I can just add a stylesheet *after* the body tag. All
those rules would still apply except for those pertaining to the body,
of course.

Jeff
 
S

Spartanicus

Toby Inkster said:
Almost useless, but still required. Their use would be to e-mail clients
that can't process HTML directly but launch the page in a browser.

And web browser email extensions (Opera's M2).
 
D

Dave Patton

It seems like I have to write an HTML formatted email (and I'm a
plain text guy!). So apart from the politics of this, what needs to go
in an HTML email?

Make sure to offer the choice of email formatting to the
users when they provide their email address, as well
as a way to login later and change the setting. I'd
suggest the default be plain text, but the client may
want the default as HTML. You have to be able to format
the content as both plain text and HTML to send emails
that contain both, so you may as well have the option
to send emails that are only plain text.
 
J

Jeff Thies

David said:
Jeff Thies wrote:




Not in HTML.
Well, you can't use <nobr> either, but it works widely if not universally.

Considering that there are mail clients that reject mail with linked
stylesheets (AOL) and others that strip out the head (most web based)...

From Andrew: <URL: http://www.alistapart.com/articles/cssemail/ >

Is there a browser out there that doesn't use styles (except for body
styles) that are in a stylesheet after the body tag?

I know that Opera7, all NS4+,IE5+, Thunderbird have no problem.

It seems to me that the worst that would happen is that would be no
styles and even that is unlikely.

No?

That has to better than tag soup or inling every style.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top