views:

227

answers:

5

Is there some sort of formatting protocol for html email? We have an automated system that sends reports via email, when I look at the source I see them delimited by line length with an "=" breaking the line. That is, I get something like :

<html><body>some text some text some text some=
some text some text some text some text som<ta=
ble>some text some text some text some text <t=
r><td...

Does anyone have any more information on what this is?

A: 

You have to send a header saying its going to be html

DFectuoso
+6  A: 

You have to send the message as multi-part MIME. Best practices are:

  • Always send an HTML and a pure text version this way for mail clients that don't support HTML or some people just turn off HTML in emails (there are security/spam isssues with images although a lot of clients won't auto-download images from non-trusted sites anyway);
  • Images can be included in the message instead of as straight links. Straight links save on bandwidth but are a spam or even security issue (eg Internet Explorer had a buffer overrun bug with PNG images). Embedded images are references with cid values; and
  • Only use the most basic HTML. Browser HTML support varies from the primitive to the bizarre. When I looked into doing this we just couldn't get a consistent (or even acceptably different) look and feel on the handful of mail clients we investigated leading us to send our reports as attached PDFs, which are, in a lot of ways, preferable (they can easily be saved, for one).

As to your garbled message, it looks to me that your message isn't being correctly identified as HTML so the mail client is wrapping lines of text at 70 or so characters.

cletus
A: 

Looks like it could be quoted-printable. How do equals symbols in the HTML look, are they replaced by =3E?

Technically there's nothing wrong with this, but it would be nice to include an alternate plain text, for those people who can't or don't want to read HTML mail (like me).

starblue
+2  A: 

Your message is being translated somehow to "quoted printable" encoding. This is probably an issue with the mail headers you're creating.

Charlie Martin
A: 

The email RFC enforces line length limits, specifically each line should be no longer than 78 characters, excluding CRLF. The equal symbols at the end of each line is just a line delimiter, which will be correctly parsed by any email reader that supports HTML, as long as the necessary headers are in place (Content-Text: text/html). More details on HTML in email conventions can be found here.

codelogic