|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Missing Dots
want to send. What's happening is in the style section of the file it is dropping the "." on class names and therefore losing some of the css styling. For example, in promo.html, class names are defined as: ..blue { color:blue; } Then when it is received as an e-mail the code then shows: blue { color:blue; } The missing dot causes the styling to render incorrectly. Does anybody know how this is happening? Below are the main snippets (I removed lines that shouldn't have any bearing on the outcome for breivity) of code I am using to generate the mailing. Thanks, Jeremy Olmstead var objFSO = Server.CreateObject("Scripting.FileSystemObject"); var fileName = objFSO.OpenTextFile("D:\\InetPub\\WWWroot\\promos \\promo.html", 1); promoText = fileName.ReadAll(); fileName.Close(); while (!promoEmails.EOF) { var objCDO = Server.CreateObject("CDO.Message"); var theName = promoEmails.Fields.Item("ContactName"); promoText = promoText.replace("*name*", theName); objCDO.HTMLBody = promoText; objCDO.Send(); promoText = promoText.replace(theName, "*name*"); promoEmails.MoveNext(); objCDO = null; } You're lucky that's all that's happening. . at the beginning of a line
tells SMTP that it's the end of the message, I bet that something in between you and the SMTP server knows this and is compensating by removing the dot. The way I have gotten around this in the past is to escape . with two dots (..). This won't render correctly in your content directly, but it should allow the SMTP server (assuming it does not get stripped by other software on its way) to ignore the leading . Another workaround may be to reference an external style sheet in the HTML, instead of inlining a <style> tag. Or using IDs (#) instead of classes (.). A Show quote "Jeremy Olmstead" <jolmstea***@-charter.net> wrote in message news:Xns97B282F2E6231jolmsteadcharternet@216.170.153.136... >I have defined a promo.html file that contains the html of an e-mail I > want to send. What's happening is in the style section of the file > it is dropping the "." on class names and therefore losing some of the > css styling. For example, in promo.html, > class names are defined as: > > .blue { color:blue; } > > Then when it is received as an e-mail the code then shows: > > blue { color:blue; } > > The missing dot causes the styling to render incorrectly. Does anybody > know how this is happening? > > Below are the main snippets (I removed lines that shouldn't have any > bearing on the outcome for breivity) of code I am using to generate the > mailing. > > Thanks, > Jeremy Olmstead > > var objFSO = Server.CreateObject("Scripting.FileSystemObject"); > var fileName = objFSO.OpenTextFile("D:\\InetPub\\WWWroot\\promos > \\promo.html", 1); > promoText = fileName.ReadAll(); > fileName.Close(); > while (!promoEmails.EOF) { > var objCDO = Server.CreateObject("CDO.Message"); > var theName = promoEmails.Fields.Item("ContactName"); > promoText = promoText.replace("*name*", theName); > objCDO.HTMLBody = promoText; > objCDO.Send(); > promoText = promoText.replace(theName, "*name*"); > promoEmails.MoveNext(); > objCDO = null; > } I've had problems with getting external style sheets to work reliably
in html emails. Your suggestion of using IDs instead of classes within an embedded style sheet is my usual work-around. -- Show quoteMike Brind Aaron Bertrand [SQL Server MVP] wrote: > You're lucky that's all that's happening. . at the beginning of a line > tells SMTP that it's the end of the message, I bet that something in between > you and the SMTP server knows this and is compensating by removing the dot. > The way I have gotten around this in the past is to escape . with two dots > (..). This won't render correctly in your content directly, but it should > allow the SMTP server (assuming it does not get stripped by other software > on its way) to ignore the leading . > > Another workaround may be to reference an external style sheet in the HTML, > instead of inlining a <style> tag. Or using IDs (#) instead of classes (.). > > A > > > > > "Jeremy Olmstead" <jolmstea***@-charter.net> wrote in message > news:Xns97B282F2E6231jolmsteadcharternet@216.170.153.136... > >I have defined a promo.html file that contains the html of an e-mail I > > want to send. What's happening is in the style section of the file > > it is dropping the "." on class names and therefore losing some of the > > css styling. For example, in promo.html, > > class names are defined as: > > > > .blue { color:blue; } > > > > Then when it is received as an e-mail the code then shows: > > > > blue { color:blue; } > > > > The missing dot causes the styling to render incorrectly. Does anybody > > know how this is happening? > > > > Below are the main snippets (I removed lines that shouldn't have any > > bearing on the outcome for breivity) of code I am using to generate the > > mailing. > > > > Thanks, > > Jeremy Olmstead > > > > var objFSO = Server.CreateObject("Scripting.FileSystemObject"); > > var fileName = objFSO.OpenTextFile("D:\\InetPub\\WWWroot\\promos > > \\promo.html", 1); > > promoText = fileName.ReadAll(); > > fileName.Close(); > > while (!promoEmails.EOF) { > > var objCDO = Server.CreateObject("CDO.Message"); > > var theName = promoEmails.Fields.Item("ContactName"); > > promoText = promoText.replace("*name*", theName); > > objCDO.HTMLBody = promoText; > > objCDO.Send(); > > promoText = promoText.replace(theName, "*name*"); > > promoEmails.MoveNext(); > > objCDO = null; > > } On Thu, 27 Apr 2006 13:52:58 -0500, Jeremy Olmstead
<jolmstea***@-charter.net> wrote: > I have defined a promo.html file that contains the html of an e-mail I Are you looking at it in a web-based email client? They have been known to > want to send. What's happening is in the style section of the file > it is dropping the "." on class names and therefore losing some of the > css styling. For example, in promo.html, > class names are defined as: mangle style sheets to prevent the message from making arbitrary changes to the page. .blue { color:blue; } may not work, but span.blue { color:blue; } might. It's also worth mentioning that Gmail doesn't allow stylesheets at all. You have to use the style attribute there. This is off-topic for the group, so you'll probably get better, more specific advice from the css-discuss mailing list. You can sign up at http://www.css-discuss.org/mailman/listinfo/css-d/. They also have a Wiki with a page that covers CSS in email at http://css-discuss.incutio.com/?page=StyleInEmail that is worth reading.
Show quote
"Justin Piper" <jpi***@bizco.com> wrote in Thanks for this info. "Escaping the dots" did the trick for me, but I news:op.s8p1ffwccs3d1w@luxembourg.psg.bizcotech.com: > On Thu, 27 Apr 2006 13:52:58 -0500, Jeremy Olmstead > <jolmstea***@-charter.net> wrote: > >> I have defined a promo.html file that contains the html of an e-mail >> I want to send. What's happening is in the style section of the file >> it is dropping the "." on class names and therefore losing some of >> the css styling. For example, in promo.html, >> class names are defined as: > > Are you looking at it in a web-based email client? They have been > known to mangle style sheets to prevent the message from making > arbitrary changes to the page. > > .blue { color:blue; } > > may not work, but > > span.blue { color:blue; } > > might. It's also worth mentioning that Gmail doesn't allow stylesheets > at all. You have to use the style attribute there. > > This is off-topic for the group, so you'll probably get better, more > specific advice from the css-discuss mailing list. You can sign up at > http://www.css-discuss.org/mailman/listinfo/css-d/. They also have a > Wiki with a page that covers CSS in email at > http://css-discuss.incutio.com/?page=StyleInEmail that is worth > reading. > may look further into using the style attribute. Also I didn't realize this was off-topic at the time of the post, because I didn't really know it was a css issue. Jeremy |
|||||||||||||||||||||||