Questions tagged [html-email]

HTML used to format emails (message content, not email addesses)

Although the HTML used to format emails is the same as that used to create web pages, it has a different set of problems and best practices.

Code Validation

Since most email clients don’t follow web standards and there are no email-specific standards in place, properly coded HTML emails will not pass HTML validating because, if coded properly, nearly all of the code within an HTML email is likely to be comprised of depreciated elements.

Client Code Compatibility

In working with HTML emails, much of the functionality possible in typical web development is not possible in email. Good practice, is to restrict code usage to that which is XHTML1.0 compliant. Recent upgrades to many platforms have allowed for some loosening of that restriction and it is now common for people to use the HTML4.0 compliance standard.

DOCTYPE

The recommended doctype for HTML email is XHTML 1.0 Strict. The reason for this is because, regardless of any alternative doctype definition, Gmail will impose XHTML 1.0 Strict regardless and of the two clients which impose their own doctype, Gmail has the largest percentage of users so it is only logical to confirm to the standard that will be imposed whether you like it or not.


Below is a list of Email Clients and Their Treatment of !DOCTYPE as well as expected results.

STRIP or IGNORE your DOCTYPE entirely:

  • AOL
  • Android Gmail Application
  • Lotus Notes 6.5, 7, 8 and 8.5
  • Outlook 2007 and 2010
  • Thunderbird 2 and 3
  • Yahoo

    Results:

    • Box model padding becomes an issue when viewing your email in IE vs Firefox
    • In IE 8, CSS padding on TABLEs are reset to “0″ – for example:
    • Center tags with a set width will no longer be centered in all browsers except IE. For example:
    • In IE, the minimum height on any EMPTY block element is 19px This is particularly important when using spacer divs.
    • In all browsers except for IE 6 and 7, paragraph elements have a default top and bottom margin of “0″ whereas it would otherwise use a default top and bottom margin of 16px.
    • In IE 8, you might see an exaggerated left margin on OLs and ULs, you will need to define the margins with inline CSS to correct this.
    • Some special characters are not supported

ACCEPT your DOCTYPE

  • Android Mail Client
  • Entourage 04 and 08
  • iPad and iPad Gmail
  • iPhone and iPhone Gmail (iOS3 & iOS4)
  • Kindle Fire
  • Live Mail
  • Outlook 2003
  • Outlook Express
  • Thunderbird 6
  • Windows Mail

Impose Their Own Standards

  • XHTML 1.0 Strict – Gmail & Hotmail

    Results:

    • Line height for small fonts may become more prevalent in all browsers except for IE. This is only an issue when using inline elements, use paragraph elements or TDs for formatting your small fonts.
    • You might see a small space below each of your images. A common fix is to useinside your image tag.
    • Some special characters are not supported
    • There may be a difference in the way your text links appear (colored underlines)
  • Yahoo Classic – HTML 4.01 Transitional

Mailchimp KB

SlideShare

SixRevisions guideline

5038 questions
32
votes
6 answers

Get the actual email message that the person just wrote, excluding any quoted text

There are two pre-existing questions on the site. One for Python, one for Java. Java How to remove the quoted text from an email and only show the new text Python Reliable way to only get the email text, excluding previous emails I want to be…
Layke
  • 51,422
  • 11
  • 85
  • 111
31
votes
13 answers

How to force min-height on table

I have this code :
This is my…
markzzz
  • 47,390
  • 120
  • 299
  • 507
31
votes
1 answer

Best Practices - Sending javamail mime multipart emails - and gmail

I have a Tomcat application that needs to send confirmation emails etc. I have coded the emailer with Javamail (mail.jar) to send multipart text/html emails. I based the code on the Java EE examples. I'm using the SMTP MTA on the local server. It…
PrecisionPete
  • 3,139
  • 5
  • 33
  • 52
29
votes
4 answers

Email formatting basics (links in plain text emails)

Sending an email from a server isn't quite as easy as sending it from a client. I know I can choose to send plain text or html, but I want to keep things as simple as possible. I have a link in the email that the user should click to reset their…
Matthew
  • 15,282
  • 27
  • 88
  • 123
29
votes
7 answers

CSS to make table 100% of max-width

Given the following for an email template:
Noah Goodrich
  • 24,875
  • 14
  • 66
  • 96
28
votes
10 answers

How to customize the email verification email from Laravel 5.7?

I just upgraded to Laravel 5.7 and now I am using the built in Email Verification. However there is 2 things I have not been able to figure out and the primary issue is how can I customize the email that is being sent to the user for verifying their…
Wayne Fulcher
  • 741
  • 1
  • 11
  • 21
28
votes
1 answer

Send table as an email body (not attachment ) in Python

My input file is a CSV file and by running some python script which consists of the python Tabulate module, I have created a table that looks like this below:- tabulate_output or | Attenuation | Avg Ping RTT in ms | TCP UP…
Durvesh
  • 293
  • 1
  • 3
  • 6
28
votes
14 answers

HTML email link color dilemma

I designed an HTML email and I am having the following issues: First my entire design is based on a blue color so any blue text will not be readable by the reader/user, text has to be white. GMAIL automatically color phone numbers and links blue but…
Asynchronous
  • 3,917
  • 19
  • 62
  • 96
28
votes
4 answers

Color a table row with style="color:#fff" for displaying in an email

We would like to display order details as table in an email ​
naveen
  • 53,448
  • 46
  • 161
  • 251
Header 1 Header 2 Header 3
 
user1417094
  • 271
  • 1
  • 3
  • 5
24
votes
5 answers

HTML Email - Is colspan allowed?

I was wondering if I use colspan attribute in a HTML table that I intend to have as an email, will email clients (Outlook etc...) understand what colspan does, as I have read that this might cause an issue with the layout?
CallumVass
  • 11,288
  • 26
  • 84
  • 154
24
votes
3 answers

How to open an installed app from an email URL in Android?

I want to open my app from an email URL, basically like the example shown below for Twitter.com. Email with link: Selection to open app or browser: After you click on the app choice, the Twitter app opens: I tried the following code, but it is…
Roadies
  • 3,309
  • 2
  • 30
  • 46
23
votes
7 answers

Is it sensible to send HTML-only email these days?

I want my web app to send certain mails as HTML in order to include product images. I could of course provide a text/plain alternative as well, but is it worth the effort in this day and age? Are there common mail clients that don't support…
Henrik N
  • 15,786
  • 5
  • 82
  • 131
22
votes
3 answers

What does MailMessage.IsBodyHtml do?

I'm testing sending out some emails via C#, but I can't tell what effect setting IsBodyHtml to true has. Regardless of the value, whatever I send in my Body shows up with a content type of "text/plain", and my HTML shows up tags and all in my email…
Eddie Deyo
  • 5,200
  • 8
  • 35
  • 35
21
votes
4 answers

HTML email align text

I am trying to align a part of text to the right and the other part to the left in an HTML mail but in Outlook the float doesn't work. So basically I am looking for float CSS in Outlook. I know it sounds pretty creepy and text-align or align=""…
user1299846
  • 387
  • 3
  • 8
  • 16