Has anyone ever put code for display on an email?
We're developing a widget that we would like to include the code into the email so that our subscribers can copy and paste into their own sites. We can easily get the code to display by converting all the html entities for display.
Our first thought was to just include the code into a textarea element... so it would be something like:
HTML code to be placed here
However, we've ran into a problem with gmail and a few other online email clients that seems to add an odd <WBR> tags into the content of the textarea.
Has anyone worked with something like this before?
Form elements in emails are also not always reliable. It's an interesting question, and we'd also like to know if anyone has tried this before.
I have tried many times, and it seriously affects your deliverability.
I think I solved the problem... (hopefully)
This appears to be working on all major email providers and email clients. We still have to try it on Outlook 2007 and AOL Mail, but so far no problems.
2. I wrapped the code in a paragraph tag, and applied the following CSS to it:
"white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word; white-space: pre-wrap; overflow:auto;"
In our testing so far, we haven't seen any problems with the spam filters catching it (since it's not an actual script at this point)
We're also providing a full text version of the email as well as a link to an online version if they're having problems.
Hope this might help someone else if they're having a similar problem.
Did you try wrapping your text in <pre> and <code> tags? This is an HTML standard for displaying code inline, but I have no idea what email clients or spam filters think of this... You can use them just like a <p> tag.
<pre><code>This is code</code></pre>
I'd definitely second Travis' point - pre/code tags are very widely used for displaying code snippets, and even Outlook 2007 reports that it supports them fully.
Has anyone solved TEXTAREA in Outlook 2007 problems?
We are trying to add a block of text for copy-and-paste, it works fine in everything apart from Outlook. We would use the PRE solution but the client wants textareas.
Currently, the content of the textarea just fills the email making it look awful and unprofessional.
From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that drive real business results.Get started for free