My team uses Sendgrid to handle email processes. We have a a way to process certain data and render it with string interpolation. Some emails have been rendering some CSS in the email body and I'm trying to figure out why.
I grabbed some of the HTML that's being passed in for a specific email which looks like this:
<meta content="text/html; charset=us-ascii" http-equiv="Content-Type" />
<meta content="Microsoft Word 15 (filtered medium)" name="Generator" />
<style>
<
!--
/* Font Definitions */
#font-face {
font-family: "Cambria Math";
panose-1: 2 4 5 3 5 4 6 3 2 4;
}
#font-face {
font-family: Calibri;
panose-1: 2 15 5 2 2 2 4 3 2 4;
}
/* Style Definitions */
p.MsoNormal,
li.MsoNormal,
div.MsoNormal {
margin: 0in;
font-size: 11.0pt;
font-family: "Calibri", sans-serif;
}
span.EmailStyle17 {
mso-style-type: personal-compose;
font-family: "Calibri", sans-serif;
color: windowtext;
}
.MsoChpDefault {
mso-style-type: export-only;
font-family: "Calibri", sans-serif;
}
#page WordSection1 {
size: 8.5in 11.0in;
margin: 1.0in 1.0in 1.0in 1.0in;
}
div.WordSection1 {
page: WordSection1;
}
-->
</style>
<!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">test<o:p></o:p>
</p>
</div>
There rendered text in the body of the email looks like this:
-
/* Font Definitions */
#font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
#font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
#font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
#page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
-->
test
Does the HTML here look wrong or are there any typos that I can't see?
Related
I have an external Html - which is actually an emails body, it has html tag and body, it is complete html in itself. I am rendering that inside Bootstrap modal
<div class="modal-body">
#Html.Raw(Model.EmailBody)
#*<iframe srcdoc="#Html.Raw(Model.EmailBody)">
</iframe>*#
</div>
But my page has other divs which is going somewhere inside the Email Body and my divs going inside Email's html.
So I tried to render external html inside an iframe and in that case My view is not distorted but somehow Email content is not coming inside iframe. When I look in dom its showing like this
<iframe srcdoc="<!DOCTYPE html PUBLIC " -="" w3c="" dtd="" xhtml="" 1.0="" transitional="" en"="" "http:="" www.w3.org="" tr="" xhtml1="" xhtml1-transitional.dtd"=""> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <!-- Email Header --> <head> <meta http-equiv="Content-Type" content="html; charset=UTF-8"></meta> <!-- Included header file, can be cloned and/or replaced. --> <!--[if gte mso 15]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG/> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> <meta charset="UTF-8" /> <!--[if !mso]><!--> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!--<![endif]--> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title></title> <!--[if mso]> <style type="text/css"> body, table, td {font-family: Arial, Helvetica, sans-serif !important;} h1 {font-family: Arial, Helvetica, sans-serif !important;} h2 {font-family: Arial, Helvetica, sans-serif !important;} h3 {font-family: Arial, Helvetica, sans-serif !important;} h4 {font-family: Arial, Helvetica, sans-serif !important;} h5 {font-family: Arial, Helvetica, sans-serif !important;} h6 {font-family: Arial, Helvetica, sans-serif !important;} h7 {font-family: Arial, Helvetica, sans-serif !important;} p {font-family: Arial, Helvetica, sans-serif !important;} </style> <![endif]--> <!--[if gt mso 15]> <style type="text/css" media="all"> /* Outlook 2016 Height Fix */ table, tr, td {border-collapse: collapse;} tr {border-collapse: collapse; } body {background-color:#ffffff;} </style> <![endif]--> <!-- Title - Optional content - The title tag shows in email notifications on mobile devices --> <title> </title> <style type="text/css"> p.solid {border-style: solid;border-width: 1px;padding: 5px} button-style {background: #222222; border: 15px solid #222222; padding: 0 10px;color: #ffffff; font-family:Ember, Arial, sans-serif; font-size: 13px; line-height: 1.1; text-align: center; text-decoration: none; display: block; border-radius: 3px; font-weight: bold;} tablebutton { border-collapse: separate; border-spacing: 10px;} </style> </head> <!-- Email Body --> </html>">
</iframe>
But I am unable to see the html. Is there any other way without or with iframe I can show my external emails
I have done this using CkEditor. In CkEditor I am showing the html. Its resolving issue, but its not great solution
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Email Confirmation</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
/**
* Google webfonts. Recommended to include the .woff version for cross-client compatibility.
*/
#media screen {
#font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 400;
src: local('Source Sans Pro Regular'), local('SourceSansPro-Regular'), url(https://fonts.gstatic.com/s/sourcesanspro/v10/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff) format('woff');
}
#font-face {
font-family: 'Source Sans Pro';
font-style: normal;
font-weight: 700;
src: local('Source Sans Pro Bold'), local('SourceSansPro-Bold'), url(https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGFkQc6VGVFSmCnC_l7QZG60.woff) format('woff');
}
}
/**
* Avoid browser level font resizing.
* 1. Windows Mobile
* 2. iOS / OSX
*/
body,
table,
td,
a {
-ms-text-size-adjust: 100%; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove extra space added to tables and cells in Outlook.
*/
table,
td {
mso-table-rspace: 0pt;
mso-table-lspace: 0pt;
}
/**
* Better fluid images in Internet Explorer.
*/
img {
-ms-interpolation-mode: bicubic;
}
/**
* Remove blue links for iOS devices.
*/
a[x-apple-data-detectors] {
font-family: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
color: inherit !important;
text-decoration: none !important;
}
/**
* Fix centering issues in Android 4.4.
*/
div[style*="margin: 16px 0;"] {
margin: 0 !important;
}
body {
width: 100% !important;
/*height: 100% !important;*/
padding: 0 !important;
margin: 0 !important;
}
/**
* Collapse table borders to avoid space between cells.
*/
table {
border-collapse: collapse !important;
}
/*a {
color: #1a82e2;
}*/
img {
height: auto;
line-height: 100%;
text-decoration: none;
border: 0;
outline: none;
}
/*a {
color: #1a82e2;
}
a[x-apple-data-detectors] {
font-family: inherit !important;
font-size: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
color: inherit !important;
text-decoration: none !important;
}*/
.bg { /*<img src="https://i.ibb.co/DMKFzSt/back.png" alt="back" border="0">*/ /*<img src="https://i.ibb.co/6tsSrfm/back.png" alt="back" border="0">*/ background-image: url("https://i.ibb.co/6tsSrfm/back.png"); /* The image used */ /* Used if the image is unavailable */ /* You must set a specified height */ /*width:100%;*/ background-position: top; /* Center the image */ background-repeat: no-repeat; /* Do not repeat the image */ background-size: cover; }
</style>
</head>
<body class="">
<!--bgcolor="#e9ecef"-->
<!-- start preheader -->
<div class="preheader" style="display: none; max-width: 0; max-height: 0; overflow: hidden; font-size: 1px; line-height: 1px; color: #fff; opacity: 0; ">
A preheader is the short summary text that follows the subject line when an email is viewed in the inbox.
</div>
<div class="container align-content-center">
<div class="bg align-content-center" style="width:750px; height:1000px; margin-left:auto;margin-right:auto;padding:50px; align-self:center;">
<h2 style="margin-top:400px;">
hi {fusername}
</h2>
<p style="font-size:16px; margin-bottom:80px;">Click the button below to confirm your e-mail adress.If you did not create an account with FlowNetMaster®, you can safely delete this e-mail.</p>
Confirm E-mail
<p style="margin-top:75px; margin-bottom:0;">If that does not work, please copy and paste the following link in your browser:</p>
<br />
<p style="margin-top:0; font-size:10px;">{femod}</p>
<p style="margin: 0;">Cheers,<br>Oxford Engineering & Software Team </p>
</div>
</div>
</body>
</html>
There is no problem on visualizing the confirmation e-mail on Apple and Android mail application but while reviewing the mail on gmail on the safari and chrome browser I can not see the background image.I hope you can give me an idea about why the background image does not shown in the e mail.
I apprecieate all you eforts ,thank you for your help.
Some mail clients blocks images, try to find some option to download it or try to use tag and place your content on this
Newbie to HTML here. Developed a web site in HTML and CSS which have now published. Seems to render fine on desktop and tablet (IPad) but not so on mobile. Have followed various suggestions particularly around viewport to resolve this without success. So now asking for help from those more knowledgeable.
UPDATE
The issue when displaying on mobile is that the navigation menu items are not listed.
The site can be viewed at http://speech4all.co.nz
I have listed the HTML for the index.html page and also the CSS below.
Thanks for your suggestions in advance
Index.html
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--[if IE 6]><![endif]-->
<meta http-equiv="Content-Language" content="EN-GB"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="language" content="EN"/>
<title>Speech4All - Speech and Language Therapy</title>
<meta name="author" content="Speech4All"/>
<link rel="author" title="Speech4All"/>
<meta name="description" content="Speech and Language Therapy Services in Auckland"/>
<meta name="copyright" content="Copyright © 2016 Speech4All, All Rights Reserved"/>
<meta property="og:title" content="Speech4All - Speech and Language Therapy, Auckland"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="index.html"/>
<meta property="og:description" content="Speech and Language Therapy Services in Auckland"/>
<meta property="og:site_name" content="Speech4All"/>
<meta name="robots" content="index,follow,noodp,noydir"/>
<meta http-equiv="imagetoolbar" content="no"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge;chrome=1"/>
<link rel="canonical" href="index.html"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link rel="stylesheet" media="screen,projection" type="text/css" id="google-fonts-css" href="http://fonts.googleapis.com/css?family=Amaranth:400,700"/>
<link rel="stylesheet" media="screen,projection" type="text/css" href="http://cdn-static.airsquare.com/5.6.4/compiled/theme/css.cfm?name=balloon&grid_max_width=960"/>
<link rel="stylesheet" media="screen,projection" type="text/css" id="managed-css" href="asset/csss4a.css"/>
<script type="text/javascript" src="../ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<body>
<div id="wrapper">
<div id="header">
<div class="container_12">
<div class="grid_12">
<div class="branding" itemscope="itemscope" itemtype="http://schema.org/Organization">
<a href="index.html" itemprop="url">
<img background-color="#add8e6" width="300" height="200" itemprop="logo" src="blah.png" alt="Speech4All" />
</a>
</div>
<div>
info#speech4all.co.nz
</div>
<div class="main-navigation">
<ul>
<li class="selected">Home</li>
<li>Services</li>
<li>FAQs</li>
<li>Resources</li>
<li>Testimonials</li>
<li>Contact Us</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div id="content">
<div class="clear"></div>
<div class="container_12">
<div class="grid_4">
<h3>About me</h3>
<p>My name is Anony Mouse and I am the Speech and Language Therapist for Speech4All in the Central Auckland Area. </p>
<p>I specialise in working with children, adolescents and adults with speech and/or language delays and disorders.</p>
<p style="text-align: center;">
<img alt="" height="386" src="./images/Blah.jpg" width="640" />
</p>
</div>
<div class="grid_4">
<h3>Qualifications</h3>
<ul>
<li>Master of Science with First Class Honours in Speech Language Sciences</li>
</ul>
<h3> </h3>
</div>
<div class="grid_4">
<h3>Why choose me?</h3>
<p>I pride myself on providing individualised client based Speech Language Therapy. I am passionate about what I do to support the communication needs of others and believe that everyone is capable of making progress. </p>
</div>
<div class="grid_4">
<h3>What I offer</h3>
<h4>Speech and Language Therapy Services</h4>
<ul>
<li>FREE consultation including a 15 minute screening to determine if Speech Language Therapy is required and would be beneficial.</li>
</ul>
</div>
</div>
</div>
</body>
CSS
body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
h1, h2, h3, h4 { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
#header .branding h1 { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
#header .main-navigation ul li a { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
.ui-tooltip-main-navigation-sub-menu .ui-tooltip-content { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
.button { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
body { background-color: #FFFFFF; }
#wrapper { box-shadow: 0px 0px 30px #283036; }
#content { background:#FFFFFF; }
#header { background:#add8e6; }
#header .branding h1 a { color:#FFFFFF; }
#header .main-navigation ul li a { color: #5A1C2E; text-decoration: none;}
#media only screen and (max-device-width: 480px)
{
td#main_box
{
-webkit-text-size-adjust:100%; -moz-text-size-adjust:100%; -ms-text-size-adjust:100%;
}
}
#header .main-navigation ul li a:hover { color:#8F1728; }
.ui-tooltip-main-navigation-sub-menu .ui-tooltip-content ul li a { color:#283036; }
.ui-tooltip-main-navigation-sub-menu .ui-tooltip-content { background:#FFFFFF; }
.ui-tooltip-main-navigation-sub-menu .ui-tooltip-content ul li a:hover { background:#8F1728; }
.ui-tooltip-main-navigation-sub-menu .ui-tooltip-content ul li a:hover { color:#FFFFFF; }
body { color:#555555; }
.cart table th { color:#555555; }
h1, h2, h3, h4 { color:#333333; }
.product h1 a { color:#333333; }
a { color:#8F1728; }
a:hover { color:#283036; }
.twitter-panel-listing { background:#F3F3F3; }
.testimonial-panel-listing { background:#F3F3F3; }
.testimonial-listing { background:#F3F3F3; }
.button { background:#add8e6; }
.button { color:#000000; }
.button:hover { color:#000000; }
th { background: #8F1728; }
th { color: #FFFFFF; }
#footer { background:#E7E7E7; }
The site looks OK to me on mobile, except your navigation isn't displaying. If that's the issue, it's because of this CSS
#media only screen and (max-width: 767px) and (min-width: 0px)
.main-navigation li:not(.toggle) {
display: none;
}
I don't see a .toggle in your code, so I presume you just want to remove that CSS and your navigation will be visible.
I am trying to get a hosted Avenir LT W01_55 Roman webfont to display in an HTML email for iOS devices.
The font is hosted here 'http://fast.fonts.net/cssapi/af395689-2c2c-43f9-9e8f-68fdef40ecac.css'
I am using the #import method like this in the head tags
'<style type="text/css">
#import url('http://fast.fonts.net/cssapi/af395689-2c2c-43f9-9e8f-68fdef40ecac.css');
td {
font-family: 'Avenir LT W01_55 Roman', Arial, Helvetica, sans-serif;}
.bold {
font-family: 'Avenir LT W01_55 Roman', Arial, Helvetica, sans-serif;}'
And reference it in the HTML content like this.
'<td style="border-collapse: collapse; font-family:'Avenir LT W01_55 Roman', Arial, Helvetica, sans-serif; font-size:25px; line-height:34px; color:#1d1d1d; margin:0;font-weight:bold;">'
It works on the web version but not after sending the test emails. Am I coding it incorrectly?
Navigation hover buttons not fully colored when mouse hovers over them. I've tried changing the width to 100% which I thought would fix it, however it did not. I've attempted to look for a few similar problems and solutions, however all of the solutions I found did not fix the problem, so I've decided to ask it personally. Thoughts?
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Sunny Acres</title>
<script src="modernizr-1.5.js"></script>
<link href="sa_layout.css" rel="stylesheet" type="text/css" />
<link href="sa_styles.css" rel="stylesheet" type="text/css" />
<style type="text/css">
section > p:first-of-type:first-line {
text-transform: uppercase;
}
section > p:first-of-type:first-letter {
font-size:250% font-family:'Times New Roman', Times, serif;
}
</style>
</head>
<body>
<header>
<h1>
<img src="salogo.png" alt="Sunny Acres" />
</h1>
</header>
<nav>
<ul>
<li>Home
</li>
<li>Autumn Fun
</li>
<li>Scary Good
</li>
<li>Meet the Animals
</li>
<li>For your Tastebuds
</li>
</ul>
</nav>
<section>
<header>
<h1>Welcome</h1>
</header>
<img src="photo1.jpg" alt="home page photo" id="promoimage" />
<p id="firstp">There's always something happening at Sunny Acres. With the coming of fall, we're gearing up for our big AutumnFest and Farm Show. If you haven't visited our famous Corn Maze, be sure to do so before it gets torn down on November 5. This year's maze is bigger and better than ever.</p>
<p>Farms can be educational and Sunny Acres is no exception. Schools and home-schooling parents, spend an afternoon with us at our Petting Barn. We have over 100 friendly farm animals in a clean environment. Kids can bottle feed the baby goats, lambs, and calves while they learn about nature and the farming life. Please call ahead for large school groups.</p>
<p>When the sun goes down this time of year, we're all looking for a good fright. Sunny Acres provides that too with another year of the Haunted Maze. Please plan on joining us during weekends in October or on Halloween for our big Halloween Festival.</p>
<p>Of course, Sunny Acres is, above all, a <em>farm</em>. Our Farm Shop is always open with reasonable prices on great produce. Save even more money by picking your own fruits and vegetables from our orchards and gardens.</p>
<p class="closing">We all hope to see you soon, down on the farm.
<br />— Tammy & Brent Nielsen</p>
<h2>Hours</h2>
<ul>
<li>Farm Shop: 9 am - 5 pm Mon - Fri; 9 am - 3 pm Sat</li>
<li>The Corn Maze: 11 am - 9 pm Sat; 11 am - 5 pm Sun</li>
<li>The Haunted Maze: 5 pm - 9 pm Fri & Sat</li>
<li>Petting Barn: 9 am - 4 pm Mon - Fri; 11 am - 3 pm Sat & Sun</li>
</ul>
<h2>Directions</h2>
<ul>
<li>From Council Bluffs, proceed east on I-80</li>
<li>Take Exit 38 North to the Drake Frontage Road</li>
<li>Turn right on Highway G</li>
<li>Proceed east for 2.5 miles</li>
<li>Sunny Acres is on your left; watch for the green sign</li>
</ul>
</section>
<footer> <address>
Sunny Acres ☀
Tammy & Brent Nielsen ☀
1977 Highway G ☀
Council Bluffs, IA 51503
</address>
</footer>
</body>
</html>
CSS:
#font-face {
font-family: 'NobileRegular';
src: url('nobile-webfont.eot');
src: local('☺'),
url('nobile-webfont.woff') format('woff'),
url('nobile-webfont.ttf') format('truetype'),
url('nobile-webfont.svg#webfontsKo9tqe9') format('svg');
}
/* body styles */
body {
background-color: white;
font-family: NobileRegular, Verdana, Geneva, sans-serif;
line-height: 1.4em;
}
/*heading styles */
section h1 {
background-color: rgb(125, 186, 240);
color: white;
font-size: 1.7em;
letter-spacing: 0.4em;
text-indent: 1em;
line-height: 1.8em;
}
h2{
background-color: rgb(0,154,0);
color: white;
color : rgba(255, 255, 255, 0.8);
letter-spacing: 0.4em;
text-indent: 1em;
line-height: 1.8em;
}
/* navigation styles */
nav ul {
list-style-type: none;
padding-left: 0.5em;
background-color: rgb(125,186,240);
line-height: 3.5em;
width:none;
float:none;
}
nav ul li a {
color: white;
text-decoration: none;
width:100%;
float:none;
}
nav ul li:hover {
background-color: rgb(83,142,213);
width:none;
float:none;
}
/*nav ul li:first-of-type {
text-transform: uppercase;
}
*/
/* section styles */
section p.closing {
color: rgb(0,165,0);
text-align: right;
}
section h2+ul {
list-style-image: url(arrow.png);
}
/* footer styles */
footer address {
background-color: rgb(55,102,55);
color: white;
color: rgba(255,255,255,0.8);
font: normal small-caps 0.8em/4em 'Times New Roman', Times, serif;
text-align: center;
}
remove padding from <ul> and add it to <li>
here is the fiddle
Change this two styles you will get the desired output.
/* navigation styles */
nav ul {
list-style-type: none;
padding-left: 0.5em;
background-color: rgb(125,186,240);
line-height: 3.5em;
PADDING-LEFT:0;
width:none;
float:NONE;
}
nav ul li a {
color: white;
text-decoration: none;
PADDING-LEFT:10PX;
width:100%;
float:none;
}