What type of doctype should be used when creating HTML mail

I work on a CMS website that sends newsletters based on an HTML page (and with conversion to plain text as a multipart / alternative option). I wonder what would be the best practice for choosing a doctype.

The design of these pages, of course, is simplified from a real website, and getting the right document for the page as such is trivial - but then again: this newsletter page will be displayed in different "browsers", from gmail to Outlook, for email clients based on Web bets will already have their own doctype, and locally installed email clients will likely have different mechanisms, possibly with different requirements.

So what - if any - should doctype be used in HTML mail?

+7
email doctype content-management-system
source share
3 answers

You can and should include a doctype that best describes the format your document is written in.

But this is exactly the same as a matter of correctness; don't expect it to really have a tangible effect. As you noticed, webmail services display HTML as part of their own document, meaning you cannot choose between Quirks and standard mode. Desktop clients often have their own shabby HTML renderings from the way back before Quirks and standards existed; they simply ignore the doctrine. And both types of clients will cripple your HTML much worse than the one implied in Quirks mode. HTML mail is a world of endless grief.

+7
source share

I usually test with and without doctype.

Essentially, you want your html to look the same in standard mode and quirksmode; For example, avoid installing the firmware and CSS width (incompatible with the model) and the test to find out which obsolete attributes work in quirksmode, but not in standard mode.

+2
source share
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Message from {shop_name}</title> </head> 

this is what prestashop uses and works very well, therefore

+1
source share

All Articles