Conditional comment for outlook desktop version not working - outlook

I keep encountering problems with my conditional comments for outlook desktop version. When viewing the email in outlook 2013 it is still showing it with border and the same font-size as for non-mso clients.
I also put the conditional comments in the head tag, but it did not work either.
If any of you can spot a typo or error somewhere in the code?
Thats the entire code I am using:
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title>Outlook conditional comments</title>
<meta charset="ISO-8859-1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keywords" content="">
</head>
<body>
<!--[if gte mso 9]>
<table class="lookout" border="0" cellpadding="0" cellspacing="0" align="left" style="max-width: 600px;
width: 100%; height: auto; font-size:3em;"> <tbody> <tr> <td>Increasing sales </td> </tr> </tbody> </table>
<![endif]-->
<table class="lookout" border="1" cellpadding="0" cellspacing="0" align="center" style="max-width: 600px; width: 100%; height: auto; font-size:1em;">
<tbody>
<tr>
<td>Increasing Sales</td>
</tr>
</tbody>
</table>
</body>
</html>
Many thanks in advance
Danie

It is showing the border because the second <table> is not hidden from Outlook. Outlook 2007/10/13/16 displays both <table>s.
We want to write two tables and wrap each in an <mso> tag: one that displays a <table> only for Outlook 2007/10/13/16, and one that hides a <table> only for Outlook 2007/10/13/16. Something like this:
<body>
<!--[if gte mso 9]>
<table class="lookout" border="0" cellpadding="0" cellspacing="0" align="left" style="max-width: 600px;
width: 100%; height: auto; font-size:3em;">
<tbody>
<tr>
<td>Increasing sales In Outlook 2007/10/13/16</td>
</tr>
</tbody>
</table>
<![endif]-->
<!--[if !mso 9]><!-->
<table class="lookout" border="1" cellpadding="0" cellspacing="0" align="center" style="max-width: 600px; width: 100%; height: auto; font-size:1em;">
<tbody>
<tr>
<td>Increasing Sales everywhere else</td>
</tr>
</tbody>
</table>
<!--<![endif]-->

It shows with a Border and font-size bacause the Bottom Table isn't hidden. Also I most times use this Term: <!--[if (gte mso 9)|(IE)]> It seems to work the best for most MSO Clients

#Niklas and #Ted: many thanks for your replies.
I did another attempt and sent the email exactly the way you suggested Ted, but unfortunately the border and 1em font-size were there again in Outlook 2013.
I was wonder whether the email client it is sent from can have an impact on how it is displayed in the email client it is viewed later on. I sent it from gmail. I saved the html doc from the browser and copied it over to gmail.
This is how the html file I copied looks like:
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title>Outlook conditional comments</title>
<meta charset="ISO-8859-1">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keywords" content="">
</head>
<body>
<!--[if gte mso 9]>
<table class="lookout" border="0" cellpadding="0" cellspacing="0" align="left" style="max-width: 600px;
width: 100%; height: auto; font-size:3em;"> <tbody> <tr> <td>Increasing sales 13</td> </tr> </tbody> </table>
<![endif]-->
<!--[if !mso 9]> <!-->
<table class="lookout" border="1" cellpadding="0" cellspacing="0" align="center" style="max-width: 600px; width: 100%; height: auto; font-size:1em;">
<tbody>
<tr>
<td>Increasing Sales everwhere else</td>
</tr>
</tbody>
</table>
<!--<![endif]-->
</body>
</html>
Any thoughts or comment on the new code are highly appreciated.
Danie

Related

Attribute th:each is not allowed here(Error in Thymeleaf template)

I have created the application that stores the Information about dogs in the database,while running the project the tables where created but dogs information were not updates.
There is an error in running this below html file
The following code is not working
<html lang="en">
<head>
<!-- META SECTION -->
<title>Dog Rescue</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- END META SECTION -->
<!-- BEGIN STYLE -->
<style>
table, th, td {
border: 1px solid black;
padding: 1px;
}
</style>
<!-- END STYLE -->
</head>
<body>
<h2>Current Dogs In Rescue</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Rescue Date</th>
<th>Vaccinated</th>
</tr>
</thead>
<tbody>
<tr th:each="dogs : ${dogs}">
<td th:text="${dogs.id}">Text ...</td>
<td th:text="${dogs.name}">Text ...</td>
<td th:text="${dogs.rescued}">Text ...</td>
<td th:text="${dogs.vaccinated}">Text...</td>
</tr>
</tbody>
</table>
</div>
<h2>Add A Dog</h2>
<form action="#" th:action="#{/}" method="post">
<label>Name<input type="text" name="name" id="name"></input></label>
<label>Vaccinated<input type="text" name="vaccinated" id="vaccinated"></input></label>
<label>Rescued<input type="text" name="rescued" id="rescued"></input></label>
<input type="submit" value="Submit"></input>
</form>
</body>
</html>
The html file is not fetching the information.
Kindly help me
Whole Project is available in
https://github.com/arulsuju/DogRescue.git
You are using the same variable name for iteration as the list variable (dogs)
, Consider using different name for iteration variable like (dog), so the code should be:
<tr th:each="dog : ${dogs}">
<td th:text="${dog.id}">Text ...</td>
<td th:text="${dog.name}">Text ...</td>
<td th:text="${dog.rescued}">Text ...</td>
<td th:text="${dog.vaccinated}">Text...</td>
</tr>

Click on table of webpage with vbscript

I would like to click on the first row of the table as given below. (Ex on '5101170017') with vbscript code. with which I am trying to scrape the webpage info. How can I do this. as this webpage is password protected I can not share the details.
<html>
<head>
<script src='../../accidentweb/interface/DwrUtilsDao.js'></script>
<script src='../../accidentweb/engine.js'></script>
<script src='../../accidentweb/util.js'></script>
<base href="http://114.255.167.200:8092/cidasEN/extend/">
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<LINK href="css/css.css" type=text/css rel=stylesheet>
<title>Functional Query results</title>
</head>
<body bottomMargin=0 leftMargin=0 topMargin=0 >
<TABLE border="1" bordercolorlight="#6D6D6D" cellspacing="1"
bordercolordark="#C0C0C0" width="120%"
cellpadding="0" bgcolor="#FFFFFF" class=font9 style="BORDER-bottom: #4D5E8C 1px solid" >
<tr bgcolor="#CCCCCC" >
<td class="title_1" width ='6%' align="center">department</td>
<td class="title_1" width ='6%' align="center">case number</td>
<td class="title_1" width ='10%' align="center">time of accident</td>
<td class="title_1" width ='20%' align="center">location of scene of accident</td>
<td class="title_1" width ='6%' align="center">operator</td>
</tr>
<tr bgcolor="#FFFFFF" style="cursor:hand"
onmouseover="onmouseoverTR(this)"
onmouseout="onmouseoutTR(this)"
onclick="clearwsInfo('2017070100002','2017070100002',this);"
ondblclick='doSelect("auditflowForm","2017070100002");'>
<TD align="center">
<script type="text/javascript" >
outprint('ChengDu Branch');
</script>
</TD>
<TD align="center">
<script type="text/javascript" >
outprint('5101170017');
</script>
</TD>
<TD align="center">
<script type="text/javascript" >
outprint('2017-06-02 17:50');
</script>
</TD>
<TD align="left">
<script type="text/javascript" >
outprint('成赤高速成自段自贡往成都方向48km');
</script>
</TD>
<TD align="left">
<script type="text/javascript" >
outprint('杨东升');
</script>
</TD>
</TR>
<script anguage="javascript" >
//clearwsInfo("2017070100002","2017070100002","");
</script>
</TABLE>
</body>
</html>
I've tried the following:
Set iframe = IE.Document.getelementbyID("listInfoFrame")
For Each ele In iframe.contentDocument.getElementsByTagName("td")
msgbox(ele.innertext)
If InStr(ele.innertext, "department") > 0 Then
Set Row = ele.ParentNode.NextSibling
Row.Click
Exit For
End If
Next
I am getting an error as Permission Denied 'iframe.contentDocument. Any one can help me please

Outlook add 1px right to cell image

I'm using outlook 2013 and I want to create email signature.
When I finished coding I found a 1px gap appear right to the image inside a table cell.
I gave that cell a background color to see if the problem from the image or from the cell itself.
I don't know if it a padding or its a right transparent border.
I search a lot for two days here and in other websites and nothing fixed.
I create another template to demonstrate this gap and here's my code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
</style>
</head>
<body>
<table width="234" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="117" height="33" style="border-collapse:collapse;padding:0;margin:0;border:none;">
<img src="http://amraymancom.ipage.com/signtures/mazaya/images/mazaya-logo.png" border="0" width="117" height="33" border="0" style="display:block;border:none;"/>
</td>
<td width="117" height="33" style="border-collapse:collapse;padding:0;margin:0;border:none;">
<img src="http://amraymancom.ipage.com/signtures/mazaya/images/mazaya-logo.png" border="0" width="117" height="33" border="0" style="display:block;border:none;"/>
</td>
</tr>
</table>
</body>
</html>
And here's a screenshot to the cell gap:
I know that coding for Outlook is a headache but I would appreciate your help if you explain to me why this gap appear and what should I do to fix this.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
</style>
</head>
<body>
<table width="234" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="117" height="33" style="border-collapse:collapse;padding:0;margin:0;border:none;">
<img src="http://amraymancom.ipage.com/signtures/mazaya/images/mazaya-logo.png" border="0" width="117" height="33" border="0" style="display:block;border:none;"/>
</td>
<td align="left" width="117" height="33" style="border-collapse:collapse;padding:0;margin:0;border:none;">
<img src="http://amraymancom.ipage.com/signtures/mazaya/images/mazaya-logo.png" border="0" width="117" height="33" border="0" style="display:block;border:none;"/>
</td>
</tr>
</table>
</body>
</html>
I'd try this. This isn't removing the gap, but I added align="left" to the td's , so the gap will be on the right and not in between. Also I would suggest to save both images as one. This makes sure it will always display correctly and will make loading times faster, as it saves on memory space.
Also since the images are on a white background maybe add them as jpg. For Email signatures its important to save as much space as possible, since you are sometimes mailing to mobile phones and you you send you signature again with each answer in each conversation.

Flying Saucer: Chinese character rendered as a box in PDF

When I use Flying Saucer to convert html page with Chinese character. The Chinese character displayed as a box like below
I have tried both methods: using the css as in this answer Flying Saucer font for unicode characters and using the code as in this answer Flying Saucer iTextPDF Chinese Fonts, but they did not work. Does anyone have another suggestion?
I have declared the UTF-8 charset in meta tag as below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html language="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> </meta>
<link rel="stylesheet" type="text/css" href="file:///opt/template/employer.css"/>
<link rel="stylesheet" type="text/css" href="file:///opt/template/style.css"/>
<link rel="stylesheet" type="text/css" media="print" href="file:///opt/template/print.css"/>
</head>
Here is the relevant section with the chinese characters:
<tbody><tr>
<td align="left" width="150" valign="top">
Name
</td>
<td align="left" width="305" valign="top">
<label id="candidateName">VU DINH THE / 你好</label>
</td>
</tr>
<tr>
<td align="left" width="150" valign="top">
Gender/Status
</td>
<td align="left" width="305" valign="top">
<label id="gender">Female</label> / <label id="status">Single
</label>
</td>
</tr>
<tr>
<td align="left" width="150" valign="top">
Date of Birth/Age
</td>
<td align="left" width="305" valign="top">
<label id="dob">12 Sep 1985</label> / <label id="age">30</label>
</td>
</tr>
And the content of print.css:
#font-face {
font-family: Arial Unicode MS;
src: url('file:///opt/template/arialuni.ttf');
-fs-pdf-font-embed: embed;
-fs-pdf-font-encoding: Identity-H;
}
Replacement of a character by an empty square or rectangle usually means that the character is not defined in the font file, and the system doesn't find information to draw it.
In this case, the HTML and CSS code is correct, but the arialuni.ttf file is incomplete.
For reference, the arialuni.ttf should be ~23 MB.

Outlook 2007/2010 adds random line breaks/white space to HTML E-Mail

**Edit, the issue only exists in the preview pane of the Outlook Web App**
I have tried just about everything, but I cannot seem to rid the white spaces/line breaks that Outlook 2007/2010 renders in its preview box on the right side of the screen. When you double-click the e-mail from the inbox list, the HTML loads perfectly. However, when it is displayed in the split inbox list/e-mail preview window, line breaks/white spaces are generated.
I have tried every trick in the book. border-collapse, border=0, display:block, cell-spacing/cell-padding:0, !important, etc. Nothing works.
Here is what I am complaining about. (I have blacked out everything for privacy sake) :
209.67.20.161/email/linebreaks.png
209.67.20.161/email/linebreaks2.png
209.67.20.161/email/linebreaks3.png
It might be the "Printed Page Limit (Microsoft Word)" that is referred to in this article:
www.emailonacid.com/blog/details/C13/horizontal_spacing_issues_in_outlook_2007_and_2010
But, I don't think so because there are some line breaks very close to each other.
BTW, I am slicing an image in photoshop and saving for web devices.
Here is the sliced image: http://209.67.20.161/email/slices.png
Be my savior...
Link to my HTML: http://209.67.20.161/email/email_sliced_forss.html
You can send the HTML e-mail to your own outlook inbox by using ctrlq.org/html-mail and copy and pasting the source of my HTML in the box after selecting HTML editer.
Style your html emails like in this example and it will render perfectly in all major clients even the old ones like lotus notes.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style media="all" type="text/css">
table td
{
border-collapse: collapse;
}
</style>
</head>
<body>
<table width="680" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="20" align="left" valign="top" rowspan="2" bgcolor="#FFFFFF" style="font-size: 10px; font-family: arial; line-height:170px;"> </td>
<td width="300" height="170" rowspan="2" align="left" valign="top">
<img src="another image" alt="" width="300" height="170" border="0"></td>
<td width="33" align="left" valign="top" bgcolor="#FFFFFF" style="font-size: 10px; font-family: arial; line-height:140px;"> </td>
<td width="327" colspan="2" align="left" valign="top" bgcolor="#FFFFFF" style="font-size: 14px; font-family: arial; color:#5D5B5C; line-height: 16px;">some exemple text here</td>
</tr>
<tr>
<td width="33" bgcolor="#FFFFFF" style="font-size: 10px; font-family: arial; line-height:30px;"> </td>
<td width="138" height="30" align="left" valign="top"><img src="image here" alt="details" width="138" height="30" border="0"></td>
<td width="189" bgcolor="#FFFFFF" style="font-size: 10px; font-family: arial; line-height:30px;"> </td>
</tr>
</table>
</body>
</html>
Here is a link to another post where I explained how to use empty TD cells instead of spacers. HTML Emails - Empty Tables/TR/TD as spacers
Try to use style="line-height:your-image-size px;" in the <td>; also, inside the image tag use style="display:block;"

Resources