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
1
vote
1 answer

Formatting HTML for Gmail signature

I have an existing Gmail signature that works fine. It was saved and implemented over a year ago. I tried copying/pasting the same signature, but even it breaks. It's almost like Gmail has changed the way they allow HTML signatures. I wanted to ask…
Lux
  • 129
  • 2
  • 12
1
vote
1 answer

HTML Email Signature Design - Mobile Trouble

Having trouble figuring out how to write HTML code that will work on both mobile and desktop email clients. Right now its working well on desktop, but whenever I open it in mobile it renders oddly - see screenshot below. I've got it into the Apple…
Kelsey
  • 13
  • 4
1
vote
2 answers

GDPR re-permission email

looking for a little advice on HTML emails and GDPR re-permission. With the new GDPR regulations I have to create an email to send out to an existing list requesting their consent to continue contacting them. My intention is to have an 'I'm in'…
CraigDev
  • 113
  • 1
  • 12
1
vote
0 answers

Python mail headers

I have an automated messaging system that sends emails with the three standard parameters, those being: To, destination and subject. The message is immediately sent after an error has been detected. The message is being sent over Python, it receives…
Melanchole
  • 35
  • 1
  • 10
1
vote
1 answer

Yahoo Mail & Gmail App not rendering height property in media query

I'm trying to build an EDM for my client and I want the height of an elment to update on mobile but it seems that specifically the height attribute doesn't take on Yahoo Mail App for iOS and Gmail App for Android. My style tag and media queries are…
Moe-Joe
  • 1,012
  • 3
  • 15
  • 27
1
vote
0 answers

Does php mail function acts as an email client?

I am working on an email sending script in plain PHP I am curious about this PHP mail function is this function is just an email client or I am configuring it wrong?
Ans Dev
  • 11
  • 4
1
vote
2 answers

Table width in Internet Explorer /Microsoft Outlook

I'm working on a mailing and I'm having problems with setting a width in a table element in IE/ Outlook. I have tried several things which I've seen in other questions but none of them seems to work. The code is this, it includes some solutions…
1
vote
2 answers

Responsive email width in Gmail

I have this email template:
Niloofar
  • 117
  • 1
  • 1
  • 13
1
vote
1 answer

Sending HTML EMail uing WPF Desktop Application

I am looking to build an Email Desktop Application for Bulk Email Sending with Html Templates. I Used the basics of system.net.mail and successfully sent a plain text mail .But now I want to add a HTML content to mail which Suitable for BULK…
1
vote
1 answer

iPhone CSS media queries

I'm currently developing an HTML email and I've written some media queries for the iPhone as follows: /* ----------- iPhone 6+, 6S+, 7+ and 8+ --------- */ @media only screen and (min-device-width : 414px) and (max-device-width :…
1
vote
1 answer

How do we get sender icon for emails in any email client (so ios mail for example )

In emails these one sees companies using icons/ avatar showing up in email sender (without opening the email) .. similar to what favicon does in browser tabs, how do we set that up ? (see Medium, Wework. Brightalk example for below screenshot) Most…
1
vote
2 answers

Send S/MIME encrypted html email with bash

How do you send an encrypted and html-formatted email through the command line? Here is the code I have so far: # Encrypt email with a certificate openssl cms -encrypt -in "/tmp/email_to_be_sent.html" -out "/tmp/encrypted.txt" -from $SENDER -to…
Nic Stack
  • 13
  • 1
  • 5
1
vote
1 answer

HTML email, tables and content are cropped/collapsed on themselves(Outlook)

I am working on an HTML email for work. I haven't done this in 10+ years and for the life of me, after reading up and re-learning the "how" of html emails(sorta), I cant figure out why my HTML tables are collapsing in on themselves. I've checked on…
somdow
  • 6,268
  • 10
  • 40
  • 58
1
vote
1 answer

CSS styles is removed of text/html content on email forwarding

I generate and send an email with text/html content. General structure: {title} {% block…
Oleksandr Yarushevskyi
  • 2,789
  • 2
  • 17
  • 24
1
vote
2 answers

HTML5 Video iOS11 issue

I've used the code from EmailOnAcid for implementing HTML5 video into e-mails, and it works in all clients,except for the standard mail client in…
Nikolai Hvid
  • 29
  • 1
  • 5