Converting HTML emails to “Well Formed XHTML Code”

fersoftware

New Member
I've trying to submit html emails to amazon's mechanical turk using the questionform xml data scheme. I'm having issues converting the html emails into well formed html data. I just input a script to grab it from my table and print the data inside the tags of the html email, but as you can see below, it's terribly formed and will not pass to mechanical turk - I've had to send the data as htmlentities() until now and this makes it difficult for HIT workers to easily solve my issues. Here's an example of how not well formed the data is - any tips on how to send this data through mechanical turk (php) or convert it to well formed html data would be appreciated. \[code\]<body text="#333333" bgcolor="#ffffff" link="#073064" vlink="#073064"alink="#073064"><a name="top"></a><table width="100%" cellspacing="0" cellpadding="10" bgcolor="#f4f2ee"> <tbody> <tr> <td valign="top" align="left"> <table width="600" cellspacing="0" cellpadding="0" bgcolor="#ffffff"> <tbody> <tr> <td style="background-color:#e8e6dd;background-image:none;background-repeat:repeat;background-position:top left;background-attachment:scroll;font-size:10px;color:#948765;line-height:200%;font-family:verdana;" >Email not displaying correctly?<ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/r" style="color:#948765;" >Viewit in your browser.</a></td> </tr> <tr> <td height="93" bgcolor="#ff6501"background="http://i1.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/banner-tt_0.jpg"> <h1 style="font-size:30px;text-transform:lowercase;line-height:16px;color:#ffffff;font-family:Helvetica,Arial,sans-serif;text-indent:63px;margin-top:0;padding-top:29px;" >SitePoint <spanstyle="font-size: 17px; display: block; text-indent: 164px; color:rgb(248, 255, 225); margin-top: 5px;">Tech Times</span></h1> </td> </tr> <tr> <td height="20" bgcolor="#C64F00" style="color:#e7fabd;font-family:arial;font-size:13px;" > <spanid="Date" style="float:right;padding-left:5px;padding-right:5px;" ><strong>Issue 309:</strong> September 21,2010&nbsp;</span>&nbsp;Tips, Tricks, News and Reviews for Web Coders </td> </tr> </tbody</table> <table width="600" cellspacing="0" cellpadding="0" bgcolor="#ffffff"> <tbody> <tr> <td colspan="5" height="10"></td> </tr> <tr> <td width="10"></td> <td rowspan="2" width="380" valign="top"> <table width="100%" border="0"style="font-family:Verdana,Arial, Helvetica, sans-serif; font-size:13px;color:#000"> <tr> <td> <a name='2'></a><h2 style="font-size:20px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;" > Introduction</h2><p> <img src="http://i2.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/lisa-lang_1.jpg" height="119"align="left" width="130" border="0" alt="Lisa Lang" /><strong><em>Sal</em>Tech Timers! Every week we aim to provide you with a feast of techgeekyness -- but this issue is particularly HUGE, with goodies foreveryone. This week, I'm proud to present our latest SitePoint release <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/y"><em>Host Your Web Site inthe Cloud</em></a><em> </em>by web evangelist Jeff Barr. Everything youneed to know about cloud computing -- and how to make it work for you --can be found in this book. </strong></p><p> In celebration of this <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/j">release</a>, we'll berunning a live webinar with Jeff Barr, Kevin Yank, Lucas Chan, and LouisSimoneau. The webinar will begin at 9:00 a.m. (Australian Eastern StandardTime) on Wednesday, 22nd September. For those in the US, the meeting startsat 4:00 p.m. (Pacific Standard Time) on Tuesday, 21st September. Places arelimited, so hurry to register now for free <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/t">here</a>!</p><p> In the meantime, to get you in the mood for the wonderful world of cloudcomputing, have a read through Toby Tremayne's latest addition to hisseries "What Cloud Computing Can Mean for Your Business." Tobyshows you how to get started, and introduces a wide range of handy (andfree) applications.</p><p> Next, the other big news of the week was the release of IE9. CraigBuckler takes a look at its interface, including some new features anddevelopment tools of this "<ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/i">Beauty of the Web</a>."</p><p> And last but not least, James Edwards has some fun with shadows forcomplex shapes. He shows you how to create a fancy solution in CSS, evenmanaging to make it work on all modern browsers.</p><p> That should keep you busy until next week. As always, feel free to comeover and join the discussions in our <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/d">forums</a>.</p><p> Keep rocking!</p><hr color="#c5b172" size="1" /><h2 style="line-height:1.2em;" ><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/h"style="color:red">Over 80% of Small Businesses Use Email Marketing ... ButOnly a Handful Use It Effectively</a></h2><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/k"><imgsrc="http://i3.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/infusionsoft120x100-em20_2.jpg"width="120" height="100" align="right" hspace="5" vspace="0" border="0"/></a><p>Discover the secrets to effective, profitable email marketingwhen you download the free report <em>"Email Marketing 2.0: the ThreeTechniques That Will Actually Make a Difference In Your EmailMarketing."</em></p><p>Hint: this report does NOT cover subject linesuggestions, SPAM words to avoid, best time of day to send, or how toaddress your contacts.</p><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/u"style="color:red"><strong>Don't wait -- Download your free copynow!</strong></a><divstyle="margin-bottom:2em;padding-bottom:1em;border-bottom: 1px dotted#C5B172;"></div><p><strong>Summary</strong></p><ul style="font-size:110%;line-height:150%;" ><li><ahref="http://stackoverflow.com/questions/3762753/#2">Introduction</a></li><li><a href="http://stackoverflow.com/questions/3762753/#5">What Cloud Computing CanMean for Your Business, Part II: Starting Your CloudInfrastructure</a></li><li><a href="http://stackoverflow.com/questions/3762753/#7">The IE9 Beta Review</a></li><li><ahref="http://stackoverflow.com/questions/3762753/#8">Creating Shadows Around Polygons in CSS</a></li><li><ahref="http://stackoverflow.com/questions/3762753/#11">New Technical Articles</a></li><li><a href="http://stackoverflow.com/questions/3762753/#12">Techy ForumThreads</a></li><li><a href="http://stackoverflow.com/questions/3762753/#13">More Techy Blog Entries</a></li></ul><div style="margin-bottom:2em;padding-bottom:1em;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:#C5B172;" ></div><a name='5'></a><h2 style="font-size:20px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;" > Starting Your Cloud Infrastructure</h2><h3 style="font-size:16px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;" > What Cloud Computing Can Mean for Your Business, Part II</h3><div> Starting out, what do we need? We have to be able to communicatewith our customers and suppliers, so we need email, perhaps instantmessaging. If we have overseas or long distance clients, some kind of VOIPphone would help to keep costs down.</div><div> We must ensure that anything we're working on is properly backedup from the business plan to product concepts and beyond. Any lossof data could be crucial when getting your product or service to market atthe right time. Keeping an eye on our schedule is vital to make sureimportant events, tasks, and meetings are managed.<br /></div><div> There's a lot more to address, but this much is enough to get usup and running so we can get about the business of doing business. But if you're not an IT person and you don't know how tosetup email servers or backup systems, where do you begin?</div><h3> Email</h3><div> Google has been a provider of innovative products in the cloud for sometime, but many are unaware just how powerful these applications can be.Gmail, for example, offers free email accounts with enormous amounts ofstorage, and an easy-to-use interface. Your email can be accessed fromanywhere, you never have to delete as everything can be archived, andbackups are taken care of for you. The only issue is that you may want toavoid sending emails to a big potential client from an anonymous, freeGmail account; to make a proper impression, you need to be able to haveyour own email address under your company name.</div><div> Google can still help you here, though; you can actually use the Gmailsystem with your own domain name. As long as you have a <amce_href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/o"href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/o">domain</a>, you can purchase aGoogle Apps for Business account for the trifling sum of US$50 a year,which lets you transfer your email hosting to Google's servers.It's a very simple process, and once done you have full IMAPaccess to your email from anywhere in the world, with a guarantee ofavailability and uptime that few can compete with certainly not in asmall business.</div><div> The cost increases as you add more email accounts, but it's stillless than you'd pay to host a server with your own email software onit. You can set up a normal email client like Outlook or Apple mail to usethe server, or use the user-friendly Gmail interface on the Web. Thismeans that no matter what happens, you'll always have access to email andthe ability to send from your own email address, even if your personalcomputers fail. There are more great benefits to using Google Apps, butwe'll explore those in the next article. For now, check out <amce_href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/b" href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/b">Google Appsfor Business</a> to get up and running with your email.</div><h3> Messaging</h3>\[/code\]Note: I removed a lot of code here in the middle so that it would allow me to post the size of this document. \[code\] <hr color="#c5b172" size="1" /><h2style="font-size:15px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;"><aname='11'></a>New Technical Articles</h2><h3><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/tu"style="color:#7B7B94"><strong>CSS3 Border Images for Beautiful, FlexibleBoxes</strong></a></h3><p><img src="http://i8.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/author_louis_lazaris_17.jpg"hspace="3" alt="Louis Lazaris" align="left" width="67" height="80" />Amongthe raft of CSS3 features gaining increasing levels of browser support, theborder-image property is often overlooked. In this article, Louis gives usthe lowdown on what it is and how to use it.</p><p align="right"><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/il"style="color:#7B7B94">Full Story...</a></p><h3><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ir"style="color:#7B7B94"><strong>HTML5 and Even FancierForms</strong></a></h3><p><img src="http://i9.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/author_tim_connell_18.jpg"hspace="3" alt="Tim Connell" align="left" width="67" height="80" />TimConnell, co-author of SitePoint's Fancy Form Design, takes a look atthe new form input types available in HTML5, and gives you the skinny onwhich ones you can start using right now.</p><p align="right"><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/iy"style="color:#7B7B94">Full Story...</a></p><h2style="font-size:15px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;margin-top:2em;padding-top:1em;border-top:1px dotted #C5B172;"><a name='12'></a>Techy Forum Threads</h2><ulclass="forums" style="margin-left:18px;padding-left:0;" ><li><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ij"style="color:#7B7B94">How do you organize your CSS?</a> in CSS</li><li><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/it"style="color:#7B7B94">Jack of all Trades...</a> in .NET</li><li><ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ii"style="color:#7B7B94">Personification of software: The contest</a> inGeneral Chat</li></ul><hr color="#c5b172" size="1" /><h2style="font-size:15px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;"><aname='13'></a>More Techy Blog Entries</h2><p style="font-size:80%;color:#aea194;" >Web Tech</p><table cellpadding="0" cellspacing="0"border="0" width="100%"><tbody><tr> <td valign="top"><imgsrc="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"height="19" /></td> <td width="7"></td> <td style="font-family:verdana;font-size:13px;" > <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/id"style="color:#7B7B94">The Threat to Software Freedom</a> </td> </tr><tr> <td colspan="2"></td> <td><font size="-2" style="color:#AEA193;" >1 comment</td> </tr><tr> <td height="3"></td> </tr><tr> <td valign="top"><imgsrc="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"height="19" /></td> <td width="7"></td> <td style="font-family:verdana;font-size:13px;" > <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ih"style="color:#7B7B94">Apple: Stuff Ups, Mistakes, and Finally MovingForward?</a> </td> </tr><tr> <td colspan="2"></td> <td><font size="-2" style="color:#AEA193;" >19 comments</td> </tr><tr> <td height="3"></td> </tr><tr> <td valign="top"><imgsrc="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"height="19" /></td> <td width="7"></td> <td style="font-family:verdana;font-size:13px;" > <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/ik"style="color:#7B7B94">Behind the Geek Out Scenes: Fancy Fonts and JauntyInput Fields</a> </td> </tr><tr> <td colspan="2"></td> <td><font size="-2" style="color:#AEA193;" >12 comments</td> </tr><tr> <td height="3"></td> </tr></tbody></table><p style="font-size:80%;color:#aea194;" >JavaScript, CSS</p><table cellpadding="0" cellspacing="0"border="0" width="100%"><tbody><tr> <td valign="top"><imgsrc="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"height="19" /></td> <td width="7"></td> <td style="font-family:verdana;font-size:13px;" > <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/iu"style="color:#7B7B94">High-performance String Concatenation inJavaScript</a> </td> </tr><tr> <td colspan="2"></td> <td><font size="-2" style="color:#AEA193;" >11 comments</td> </tr><tr> <td height="3"></td> </tr></tbody></table><p style="font-size:80%;color:#aea194;" >WebDesign</p><table cellpadding="0" cellspacing="0" border="0"width="100%"><tbody><tr> <td valign="top"><imgsrc="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"height="19" /></td> <td width="7"></td> <td style="font-family:verdana;font-size:13px;" > <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dl"style="color:#7B7B94">WordPress Trademark Transferred To WordPressFoundation</a> </td> </tr><tr> <td colspan="2"></td> <td><font size="-2" style="color:#AEA193;" >2 comments</td> </tr><tr> <td height="3"></td> </tr></tbody></table><p style="font-size:80%;color:#aea194;" >Community</p><table cellpadding="0" cellspacing="0" border="0"width="100%"><tbody><tr> <td valign="top"><imgsrc="http://i10.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/nlblog_19.gif" width="16"height="19" /></td> <td width="7"></td> <td style="font-family:verdana;font-size:13px;" > <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dr"style="color:#7B7B94">Important People With Things to Say</a> </td> </tr><tr> <td height="3"></td> </tr></tbody></table><hr color="#c5b172" size="1" /> </td> <td width="10"></td> </tr> <tr> <td width="10"></td> <td width="20"background="http://i5.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/vertical-rule-bg_14.gif"></td> <td width="180" valign="bottom" style="color:#000000;font-family:verdana;font-size:13px;" ><div id="subscribe"> <h2 style="font-size:15px;font-weight:bold;color:#073064;font-family:Arial, Helvetica, sans-serif;line-height:110%;" > Follow SitePoint on.. </h2><ul style="margin-left:5px;list-style-type:none;list-style-position:outside;list-style-image:none;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;" > <li style="font-size:15px;" > <img src="http://i1.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-nl_20.gif"border="0" height="27" width="27" align="bottom" alt="Newsletters" /><astyle="margin-left:5px; text-decoration:none; font-weight:400"href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dy">Newsletters</a></li> <li style="font-size:15px;" > <img src="http://i2.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-tw_21.gif"border="0" height="27" width="27" align="bottom" alt="Twitter" /><astyle="margin-left:5px; text-decoration:none; font-weight:400"href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dj" rel="nofollow">Twitter</a></li> <li style="font-size:15px;" > <img src="http://i3.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-m_22.gif" border="0"height="27" width="27" align="bottom" alt="Mobile" /><astyle="margin-left:5px; text-decoration:none; font-weight:400"href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dt">Mobile</a></li> <li style="font-size:15px;" > <img src="http://i4.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-pod_23.gif"border="0" height="27" width="27" align="bottom" alt="Podcast" /><astyle="margin-left:5px; text-decoration:none; font-weight:400"href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/di">Podcast</a></li> <li style="font-size:15px;" > <img src="http://i5.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-rss_24.gif"border="0" height="27" width="27" align="bottom" alt="RSS" /><astyle="margin-left:5px; text-decoration:none; font-weight:400"href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dd">RSS</a></li> <li style="font-size:15px;" > <img src="http://i6.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/subs-fb_25.gif"border="0" height="27" width="27" align="bottom" alt="Facebook" /><astyle="margin-left:5px; text-decoration:none; font-weight:400"href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dh" rel="nofollow">Facebook</a></li></ul></div> <h2style="font-size:15px;font-weight:bold;color:#C64F00;font-family:arial;line-height:110%;">HelpYour Friends Out</h2> <p>People you care about can benefit from the wealth of information onnew and maturing technologies available on the Internet. Help them learn how to do it by forwarding them this issue of the Tech Times!</p> <!--[if gte mso 0]><div style="display:none;" ><![endif]--> <table cellspacing="0" cellpadding="0" bgcolor="#F9990C"> <tr> <td colspan="3" height="3" bgcolor="#C2721C"></td> </tr> <tr> <td colspan="3" height="10"></td> </tr> <tr> <td width="10"></td> <td style="color:#ffffff;font-family:verdana;font-size:13px;font-weight:bold;" >Send this to a friend</td> <td width="20"></td> </tr> <tr> <td colspan="3" height="5"></td> </tr> <tr> <td width="10"></td> <td style="font-family:verdana;font-size:13px;" > <form autocomplete="on"action="http://www.sitepoint.com/newsletter/forward" method="get"style="margin: 0pt;"> <input name="newsletterid" value="http://stackoverflow.com/questions/3762753/3" type="hidden"> <input name="fromemail" value="http://stackoverflow.com/questions/3762753/[email protected]" type="hidden"> <input name="issuenum" value="http://stackoverflow.com/questions/3762753/309" type="hidden"> <input autocomplete="on" name="email" value="http://stackoverflow.com/questions/3762753/[email protected]"style="width: 120px;" type="text"> <br /> <input autocomplete="on" name="Send" value="http://stackoverflow.com/questions/3762753/Send" type="submit"> </form> </td> <td width="20"></td> </tr> <tr> <td colspan="3" height="10"></td> </tr> </table> <!--[if gte mso 0]></div><![endif]--> </td> <td width="10"></td> </tr> <tr> <td colspan="5" height="20"></td> </tr> <tr> <td colspan="5" height="10" bgcolor="#9999BC"></td> </tr> <tr> <td bgcolor="#D7D7E5"></td> <td bgcolor="#D7D7E5" colspan="4" style="font-family:verdana;font-size:10px;color:#5e5e91;" > <table width="100%" cellspacing="0" cellpadding="0"style="font-size:12px"> <tbody> <tr> <td width="100%" height="10" bgcolor="#D7D7E5"></td> <td rowspan="3" bgcolor="#032a5c" style="color:#FFF;font-size:12px;text-align:center;" > We send this newsletter using Campaign Monitor<br/><br/> <ahref="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/dk"><imgsrc="http://i7.cmail2.com/ei/y/4D/1C6/61A/231513/csimport/cm-passive-200x125_26.png" width="200"height="125" hspace="10" border="0" alt="Campaign Monitor"/></a> </td> </tr> <tr> <td style="font-size:12x!important;font-family:arial,verdana;" > <p style="font-weight:bold;color:#353553;" >You aresubscribed as: <br><span style="font-size:13px;color:#CE6E11;font-weight:700;" ><code>[email protected]</code></span></p> <ul> <li><a href="http://sitepointcom.cmail2.com/t/y/u/cvkit/ddktkrydd/"style="color:#7B7B94">Unsubscribe</a> from this list.</li> <li><a href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/du"style="color:#7B7B94">Manage your subscriptions</a>.</li> <li><a href="http://sitepointcom.cmail2.com/t/y/l/cvkit/ddktkrydd/hl"style="color:#7B7B94">View the newsletter archives</a>.</li> </ul> <p> <span style="font-weight:bold;color:#353553;" >MailingAddress:</span><br /> <span style="font-size:12px;" >48 Cambridge St, Collingwood, VIC,3066 Australia</span> </p> <p><strong><span style="color:#353553;" >Phone:</span> +61 39090 8200</strong></p> </td> </tr> <tr> <td height="10" bgcolor="#D7D7E5"></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody></table><img src="https://cmail2.com/t/y/o/cvkit/ddktkrydd/o.gif" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" ></body>\[/code\]EDIT: Just changed it to fix the issues below, and it's still not passing the validation test - any additional steps I should take/try?
 
Back
Top