I am trying to automatically build html emails and am trying to figure out whether there are standards and what attributes in an email work and which have to exist. Do I need a ? And if no does there have to be a body? Do I need to specify what Doctype I am using?
I am working with the Zend Framework in their example they don’t set anything but the content with ‘styling’ code http://framework.zend.com/manual/de/zend.mail.html-mails.html
Just so you know why I do need HTML. This seesm stupid but our company is writing support software and the one critical ‘bug’ or feature request all out beta testers was basic HTML so they can highlight important words by making them fat, italic, underlined etc.
Coding for HTML email I’ve always found to be a crap shoot. Unlike browsers, few mail clients adhere to W3C standards for HTML markup. MailChimp‘s a pretty sweet service that will let you preview your HTML emails in 30 some odd email clients, including web-based ones.
They also have a guide freely available containing some valuable do’s and don’ts.
In short, inline CSS is going to be your best bet (especially with web clients that will strip out certain CSS). Tables are more reliable for styling in this case (though, being a standards warrior, I cringe to say it).
As for html and body tags – I send them in my emails. You’re guiding principal should be KISS (keep it simple, stupid!).