Mobile Safari/ iPhone Mail.app HTML design issues: prevent autolinking and styling auto-links (dates, addresses, etc.) - html

i am trying to design an HTML e-mail that should also look good when it is read on mobile devices. My biggest problems are with the iPhone (iOS 4): its mostly undocumented "auto linking" feature really bugs me.
Autolinking seems to appear on
phone numbers (this is the only documented feature, as explained here)
addresses
dates
Is there any documentation out there on how to
disable auto linking for dates and addresses
"correct" the autolinking via microformats or something similar (so the results are better than they actually are with iOS 4)
Any information, hints, or clues are really appreciated because there does not seem to be any information out there whatsoever.

This question was answered a long while back in this thread How to disable phone number linking in Mobile Safari? but to reiterate for all other SEO visitors like myself....
...according to the Safari Web
Content Guide for iPhone:
<meta name="format-detection" content="telephone=no">

I actually figured out a trick to do this. It's pretty horrible, but it works. You can read my post about it at http://commondream.net/post/8933806735/avoiding-data-detectors-in-ioss-mail-app, but the general gist is that data detectors won't link content that is already a link in HTML emails, so you can turn something like:
<span>Tuesday</span>
into:
<a href="#tuesday" id="tuesday"
style="color: #000; text-decoration: none;">Tuesday</a>
It's horrible code, but it keeps the data detectors from happening with only a couple of drawbacks, namely ugly markup and the mail client scrolling to that particular item if you click on it.
All of that said, I think it's pretty limited when you should disable data detectors. I had an email that listed weather forecasts by day of week, and felt like no user would ever want to mark that information down in their calendar, but I'd say you shouldn't disable data detectors if you ever think that they could actually be useful.

For dates & addresses, you could disrupt the data recognition pattern matching by inserting e.g. a zero width entity. E.g.,
M​arch 30, 2013
Tested on iOS Mail 4.3 and 6.0.

Boca Raton, FL 33487
Change the color to whatever matches your text, text decoration removes the underline, pointer events stops it from being viewed like a link in a browser
This is perfect for HTML emails on ios and browser.

We ran into this issue as well. In order to disable the format detection of addresses in Safari on iOS, we wrapped our address in an <a> tag without a href attribute and with a style attribute defining the color that we wanted it to be:
<a style="color: #c0c0c0;">Square, Inc., 901 Mission Street, San Francisco, CA 94103</a>
The result is still clickable in iOS Safari, but is rendered in the color that we desired.
In other browsers the link is not clickable and because the inline style color was the same as the existing text, it didn't look any different that the surrounding text.

I don't think you can disable auto linking for addresses and dates like you do with phone numbers, at least it is not in the Apple's official documentation, the Safari HTML Reference.
A hack to try to prevent auto linking is to use some redundant tags in the content. For example, instead of writing out <div>+61 3 777 8888</div>, you could do something like <div><foo>+61 3 777</foo> 8888</div>. It's not very elegant, but it might achieve what you want.

If you can get away with it, enclosing in single quotes will disable auto-linking. This also works for the subject line, where you can't use HTML tricks.

I use this solution for auto links that need to be styled
<span class="applelinksWhite">or call 1-666-12<span>3-456</span>7</span>
Then, I add this to my style tag. I use it in the body as some clients strip it from the head.
.applelinksWhite a {color:#ffffff !important; text-decoration:none;}
So the applelinks span covers ios devices' auto linking, and I throw in a basic span in the middle of the text string to throw off other clients like gmail. Tested in Litmus and working across the board.
This works for any kind of auto links.

Creating <a> link tag that doesn't do anything seems to be the best option for date and address at least:
July 18, 2014
You can use
<meta name="format-detection" content="telephone=no">
for phone numbers ONLY and it will disable phone links for all; This may not what you want to do.
If you don't use this meta tag, you can style with CSS to change the link color as desired. and use above code (<a> tag) for phone numbers that you don't want to link.

Related

html: how to start with a space in title

It seems the starting &nbsp was ignored in the title tag.
Demo below:
<title> pika</title>
I wondered is there a way to hack this, maybe using a foreign character which looks like a space? Any advice?
There are potential reasons for doing this. Especially if search engines isn't a consideration. In a web app, you may want to dynamically change the title for effect, for example.
In the situation I had, we wanted to flash an emoji if you moved to another tab and activity occurred on the hidden tab. Were only using Chrome and this worked for us. Getting the spacing right is still a trick.
The character ᠎ is called a Mongolian space and is not strictly considered a space character for classification purposes. I found that if you lead with this, you can put whatever you want after, for example:
<title>᠎ Title</title>
No, you shouldn't format the title in any way.
It's just information to the browser, that it will display outside the page itself. Typically it's shown in the name of the browser or on the tab for the page.
Do you really think spaces is a good solution? What will happen with different screen resolutions? How spaces will behave on tabs?

Universal descriptions for emails across different clients

Is there a universal way to set the lead-in, description, meta text for an email in email campaigns?
I'm talking about this last bit of text, as seen in Gmail on Chrome:
For this scenario I am using MailChimp, but I'd like to know if there is a universal HTML implementation that works across every mailing client.
The email in the example above contains only text, making this easy - but what if the emails don't have text (my employer loves putting just images in emails to preserve her brand's fonts) or if I simply want different text to come up. Is there a field for that? Or an HTML tag of some sort? Or anything hacky but works well?
I've tried using things like alt attributes on the images, using display: none on a <span> at the top and putting the description in there, and using <meta name="description"> but nothing seems to work on all email clients.
I'm currently testing things out on my iOS Mail app, my iOS Gmail app, and Gmail in Chrome and different things come out for each with each of these implementations.
Universal? Not really because each email client can handle it differently, but here's a really useful write-up from Litmus on the topic: https://litmus.com/blog/the-ultimate-guide-to-preview-text-support. They suggest adding a div right after the opening body tag to explicitly define what preview text appears:
<body>
<div>
Your preview text here.
</div>
</body>

prevent Mac Mail from inserting a link into a text string with ".com"

I'm testing consumer-facing HTML email for a client. In several areas, business names are dynamically added to the text. Sometimes the business name could be, for instance, "Staples.com". Mac Mail is automatically linking this.
In our case it's a problem, because we need to tightly control the exit points for the user. In some cases, we need to track and report exits, but the autolink over-writes our tracking link. Additionally, the auto-link comes with its own light blue color and formatting, so that on our medium-blue background, it is difficult to read.
How can I construct the a tag around the text to prevent Mac Mail from adding ANY link or formatting? I need Mail to leave it alone!
I kind of feel like I cheated when I answer my own question, but maybe this will help someone else. This was just tested and worked. The key appears to be to add a valid website in the href of the a tag. That's what I did, and then forced in a bunch of formatting to ensure it did not look anything like a link, even though it is one.
<a style="color:#ffffff; text-decoration:none; cursor: text;" href="http://www.my-tracking-link.com" class="welcomelink">Staples.com</a>
.welcomelink repeats the inline styles and also manages the hover and visited states.

Strike-through in HTML Emails

I'm currently coding an HTML email, using MailChimp to test it, and eventually to send it.
The email advertises several sales, which are displayed using the HTML strike tag. For some reason, these strike tags are not coming through to the finished test emails.
Code as it appears in MailChimp:
<strike>$12.95</strike> SALE! $9.95
Code in the test email, retrieved using Chrome Web Tools:
$12.95 SALE! $9.95
I've personally verified that this is happening in Gmail, Outlook 2007, and Yahoo! Mail. A quick perusal of my MailChimp Inbox Inspector results tells me the problem is definitely not limited to these three.
Any idea why this might be happening? Is there a more reliable alternative I could use without resorting to images?
An in-line style of text-decoration:line-through is your best option and it seems to be widely supported. The PDF on that page has a much larger result set for many more clients.
Try:
<span style='text-decoration: line-through;'>12.95</span> SALE $9.95
These are the styles to color the text and srikethrough the text:
<span style="color:red; text-decoration:line-through;">
<span style="color:black;">black with red strikethrough</span>
</span>
you could try the css property text-decoration: line-through; - might be more widely accepted...
At risk of having your style stripped from the email, you can try an inline style on each element.
<span style="text-decoration: line-through;">$12.95</span>
But the thing to really remember in this case is that html newsletters are finicky and cannot be reliably styled to be identical in all of the mail clients. That's pretty much why it is suggested to rely entirely on old style tabled html with no background images or modern css.
While you CAN add styles and you might get them to avoid being stripped out, it is still not guaranteed in every client.
My suggestion is to go all raw tabled html and resort to images if it;s that important. Otherwise compose a list of the mail clients that mean the most to you and get it working however you can for all of those and just forget about the rest.

What guidelines for HTML email design are there? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
What guidelines can you give for rich HTML formatting in emails while maintaining good visual stability across many clients and web based email interfaces?
An unrelated answer on a question on Stack Overflow suggested:
http://www.campaignmonitor.com/blog/archives/2008/05/2008_email_design_guidelines.html
Which contains the following guidelines:
Place stylesheet in <body> instead of <head>
Some email clients will strip CSS out of the head, but leave it if the style block is (invalidly) in the body.
Use inline styles where ever possible
Gmail will strip any stylesheet, whether in the <head> or in the <body>, but honor inline styles assigned using the style="" attribute
Return to tables
Email standards have actually taken a giant step backwards in recent years thanks to Outlook 2007 using the Microsoft Word rendering engine. Unlearn most of what you learned about positioning without stylesheets.
Don't rely on images
Most clients and most web based email clients will not display images unless the user specifically requests them to be displayed.
I also have a few "unconfirmed" truths that I don't remember where I read them.
Don't use more than two levels of nesting in tables
Is this true. What is likely to happen if I do? Is there any particular client/clients that choke on this?
Be careful of nesting background images in cells/tables
As I understand you may encounter situations where the background image is applied in the descending table/cell completely anew, and not just "shining through". Again, true or not? Which clients?
I would like to flesh out this list with more guidelines and experiences from the trenches.
Can you offer any further suggestions?
Update: I'm specifially asking for guidelines for the design part in HTML and consistency there of. Questions about general guidelines for avoiding spam filters, and common courtesy are already on SO.
It's actually really hard to make a decent HTML email, if you approach it from a 'modern HTML and CSS' perspective.
For best results, imagine it's 1999.
Go back to tables for layout (or preferably - don't attempt any complex layout)
Be afraid of background images (they break in Outlook 2007 and Gmail).
The style-tag-in-the-body thing is because Hotmail used to accept it that way - I'm pretty sure they strip it out now though. Use inline styles with the style attribute if you must use CSS.
Forget entirely about float
Remember your images will probably be blocked - use background and text colour to your advantage - make sure there is some readable text with images disabled
Be very careful with links, be especially wary of anything that looks like a URL in the link text - you will anger 'phishing' filters (eg www.someotherdomain.tld is bad)
Remember that the "fold" on webmail clients tends to be extremely high up the page (on a 1024x768 screen, most interfaces won't show more than a hundred pixels or so) - get your identity stuff in right at the top so the recipient knows who you are.
Recent version of outlook have a "portrait" preview pane which is significantly narrower than you may be expecting - be very wary of fixed-width layouts, if you must use them, make them as narrow as you can.
Don't even think about flash, Javascript, SVG, canvas, or anything like that.
Test, a lot. Make sure you test in a recent Outlook (things have changed a lot! It now uses Word as its HTML rendering engine, and it's crippled: Word 2007 HTML/CSS support). Gmail is pretty finicky also. Surprisingly Yahoo's webmail is extremely good, with nice CSS support.
Good luck ;)
Update to answer further questions:
Don't use more than two levels of nesting in tables
I believe this is an older guideline pertaining to Lotus Notes. Nested tables should be okay, but really, if you have a layout that's complicated enough to need them, you're probably going to have trouble anyway. Keep your layout simple.
Be careful of nesting background images in cells/tables
This may be related to the above, and the same applies, if you're getting that complicated then you will have problems. Recent versions of Outlook don't support background images at all, so you'd be best advised to forget about them entirely.
Always use multipart mime and provide a plain text alternative.
The folks behind Campaign Monitor also started a Email Standards Project web site with a lot of good information.
Take a look at this boilerplate, it is like html5boilerplate, but for emails:
http://htmlemailboilerplate.com/
I think this is lower level than the question you are asking, but if you really want an html email to be correctly viewed by as many clients as possible, make sure it's using valid MIME. In particular, for an email to be considered as valid MIME, the headers MUST (in the RFC sense of the word) contain both of these headers:
MIME-Version:
Content-Type:
Very strict clients will display your HTML as raw text if one or the other of these is missing. You'd be surprised how many large online vendors who should know better have screwed this up (notably, I've gotten HTML emails w/ missing MIME-Version: headers from Amazon and the ACM in the past)
Background images are not reliable.
Practically a no-brainer, but no javascript.
Use an editor that lets you send the current file/buffer as an email, or at the very least, find a program that would let you send the contents of a file as an HTML email. do not test your emails by copying the HTML, and pasting it into outlook (or any other mail program for that matter).
Three words of advice: test, test, test.
Check out LitmusApp.com's email testing service. You send them a message and they render it in a bunch of clients and show you screenshots of the results. It's not perfect, but it's pretty good.
(Lotus Notes prior to 8.0 really, really stinks for HTML mail, by the way)
Also, beyond just inline CSS styles, I recommend switching to tags wherever possible.
Embed your images, don't link to them.
This is bad :
<img src="http://myserver.com/myImage.jpg" alt="Lolkat"/>
This is good :
<img src=cid:myImage/>
Yeah, it looks weird but check out this guide regarding embedding images in emails.
If you're including a style block don't begin any new line with ".classname" or "." anything. Put a brace or something before the period. If you don't do this some web mail systems will not properly display your style sheets.
Many people have incorrectly assumed they cannot use CSS blocks in emails because of this behavior... IIRC "." is the body delimiter for SMTP. Systems will tend to escape in their mail stores to prevent the contents of one message from being misrecognized as a new message. The way this is handled tends to break any style starting on a new line with a period.