Webmail: HTML Headers

HTML email is a complex beast. The decision about what to send (as the sender) and what to display (as the recipient) is difficult and potentially dangerous.

On the recipient side, we have webmail , and we have regular email clients . For my purposes, I believe that “webmail” is all that HTML email displays as part of something that HTML itself is, and regular email clients are all that HTML email displays in a different context (for example, OS- and software GUI).

What should I do with HTML email messages ( <head> , <title> , <meta> , ...) in an email?
Is there a specification somewhere, be it the actual standard or the de facto standard?

My motivation for the request is that we use HTML Purifier to sanitize our HTML code and, if its Core.CollectErrors reports changes in the reports. This "message" is necessary ... and disappointing. We highlight some of the reported errors as not significant for our purposes, but the HTML headers mark a massive hurdle:

Someone could potentially use <link> in their email, which we would share. (HTML cleaner is for HTML snippets, not for full documents)

The desire to use things like <link> in HTML emails certainly seems to exist , and there are many email clients that send <meta> -tags in an HTML header (such as Outlook), but how are things handled in the wild? Is it safe to divulge them (which for our purposes means “inextricable change”) and carry proverbial guilt on the sending side if it breaks? It is reasonable? Has anyone ever solved this in one way or another? My google-fu is weak .:(

+4
source share
3 answers

I seriously doubt that there is a specification wherever it is specified how HTML emails should be embedded in email clients. It is basically a matter of achieving parity with existing webmail providers that provide the ability to view HTML email. I suspect styles are a notable exception, but I also suspect that most HTML email programs that support this heavy style are pretty limited by what they can and cannot do, given how things on the Internet can handle them. I would suggest doing some experimentation and consulting the source code for open source email systems such as SquirrelMail.

If you are worried about losing information, one thing many customers let you do is download the HTML source for offline viewing. Of course, he tends to be pretty cruel, so I don’t know why anyone would do this.

+1
source

You should see:

http://htmlemailboilerplate.com/

You will find the template code for HTML emails. There is also a slide show with good practice.

+1
source

My approach to HTML email is to write the kind of basic HTML we did in the 1990s - tables, minimal inline CSS (only for colors), and that is pretty much the case. I don't know how modern clients deal with CSS positioning, but people still use Outlook 2003, which I believe is based on the hated rendering engine that runs IE6, so it pays for the lowest common denominator.

I have never seen anything like the standard, I saw some mail clients (GMail) highlight various things, including CSS, while others simply ignore some things (Outlook and background images).

Rationally, I can’t think that the use of any meta-information will be in e-mail anyway - it’s quite difficult to get people to read e-mail anyway, I suspect that I’ll look even less at the source! I always included a title tag in case something wants to use it as a theme, but even this is a blow in the dark.

Whenever I watched how messages are being requested on the server side - it is true some time ago, but I never noticed that something was cached. You open mail, requests are executed again. I’m sure everything has passed since the last time I checked, but personally - I’ll still be inclined to keep the HTML email address as simple and distant as possible.

0
source

Source: https://habr.com/ru/post/1347572/


All Articles