1

编辑以添加我的代码。

我为我的企业设计并编写了一个新的 html 电子邮件模板,我 99.99% 确信我的所有表格标签都已正确关闭,但是当我在 Outlook 2003 中收到电子邮件时,有(两个)随机关闭和标签。我已经通过 W3Cs 验证器运行了电子邮件的在线版本,并且一切正常。

以前有人遇到过这个吗?或者这是我必须忍受的事情以及 html 电子邮件的其他几个问题?

可以在此处找到电子邮件的结果。

我的代码:

<!-- Main holding table -->
<table cellspacing="0" cellpadding="0" border="0" width="100%" bgcolor="#350d03">
    <tr><!-- Main holding table row -->
        <td><!-- Main holding table data -->
            <!-- Header table -->
            <table cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff" align="center">
                <tr><!-- Spacer row -->
                    <td height="30" width="600"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td width="600" align="center"><a href="http://www.example.co.uk" target="_blank"><img src="linktoimage" alt="Western House Hotel" title="Western House Hotel" border="0" width="312" height="38" /></a></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="20" width="600"></td>
                </tr><!-- End spacer row -->
            </table> <!-- End header table -->   
        </td>
    </tr>
    <tr>
        <td>
            <!-- Main image feature table -->
            <table cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff" align="center">
                <tr>
                    <td width="600"><img src="linktoimage" alt="Western House Hotel" title="Western House Hotel" width="600" height="340" /></td>
                </tr>
            </table><!-- End main image feature table -->        
        </td>
    </tr>
    <tr>
        <td>
            <!-- Book direct with us table -->
            <table cellspacing="0" cellpadding="0" width="600" bgcolor="#210401" align="center">
                <tr><!-- Spacer row -->
                    <td height="10" width="25"></td>
                    <td height="10" width="400"></td>
                    <td height="10" width="150"></td>
                    <td height="10" width="25"></td>
                </tr><!-- End space row -->
                <tr>
                    <td height="10" width="25"></td>
                    <td width="400" valign="middle"><p style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #ffffff; margin: 0px 0px 0px 0px; text-transform: uppercase;">For best available rates <span style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; font-weight: normal; color: #bb8d09; margin: 0px 0px 0px 0px; text-transform: none;">book direct with us</span></p></td>
                    <td height="10" width="150" align="right"><a href="http://www.example.co.uk" target="_blank"><img src="linktoimage" alt="Visit our website" title="Visit our website" border="0" width="136" height="28" /></a></td>
                    <td height="10" width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="10" width="25"></td>
                    <td height="10" width="400"></td>
                    <td height="10" width="150"></td>
                    <td height="10" width="25"></td>
                </tr><!-- End space row -->    
            </table><!-- End book direct with us table --> 
        </td>
    </tr>
    <tr>
        <td>
            <!-- Main content table -->
            <table cellspacing="0" cellpadding="0" width="600" bgcolor="#ffffff" align="center">
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td height="25" width="25"></td>
                    <td height="25" width="550" colspan="3" align="center"><img src="linktoimage" alt="Page divide" width="548" height="18" /></td>
                    <td height="25" width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td height="20" width="25"></td>
                    <td height="20" width="265">
                        <!-- Main feature left table -->
                        <table cellspacing="0" cellpadding="0" width="265" bgcolor="#ffffff" align="center">
                            <tr>
                                <td width="265"><p style="font-size: 20px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: bold; color: #350d03; margin: 0px 0px 0px 0px; text-transform: uppercase;">Special Valentines Package!</p></td>
                            </tr>
                            <tr><!-- Spacer row -->
                                <td height="15" width="265"></td>
                            </tr><!-- End spacer row -->
                            <tr>
                                <td width="265"><p style="font-size: 16px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #bb8d09; margin: 0px 0px 0px 0px;">Stay and dine in the beautiful 4 star Western House Hotel between 9th and 17th February for only &pound;139*!</p></td>
                            </tr>  
                            <tr><!-- Spacer row -->
                                <td height="25" width="265"></td>
                            </tr><!-- End spacer row -->
                            <tr>
                                <td width="265" align="left" valign="middle"><a href="http://www.example.co.uk" target="_blank"><img src="linktoimage" alt="Book Now!" title="Book Now!" border="0" width="114" height="27" /></a></td>
                            </tr>      
                        </table><!-- End main feature left table -->        
                    </td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"><img src="linktoimage" alt="Special Valentines Package" title="Special Valentines Package" width="265" height="175" /></td>
                    <td height="20" width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td height="25" width="25"></td>
                    <td height="25" width="550" colspan="3" align="center"><img src="linktoimage" alt="Page divide" width="548" height="18" /></td>
                    <td height="25" width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td width="25"></td>
                    <td width="265">
                        <!-- Sub feature table left -->
                        <table cellspacing="0" cellpadding="0" width="265" bgcolor="#ffffff" align="center">
                            <tr>
                                <td width="265"><img src="linktoimage" alt="Mother's Day Treat" title="Mother's Day Treat" width="265" height="140" /></td>
                            </tr>
                            <tr>
                                <td height="15" width="265"></td>
                            </tr>
                            <tr>
                                <td width="265"><p style="font-size: 17px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: bold; color: #350d03; margin: 0px 0px 0px 0px; text-transform: uppercase;">Mother's Day Treat!</p></td>
                            </tr>
                            <tr>
                                <td height="10" width="265"></td>
                            </tr> 
                            <tr>
                                <td width="265"><p style="font-size: 13px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #7a7a7a; margin: 0px 0px 0px 0px;">Treat your mother to a fantastic dinner and a nights stay in the 4 star Western House Hotel for only &pound;139*!</p></td>
                            </tr>
                            <tr>
                                <td height="25" width="265"></td>
                            </tr>   
                            <tr>
                                <td><a href="http://www.example.co.uk" target="_blank"><img src="linktoimage" alt="Book Now!" title="Book Now!" border="0" width="114" height="27" /></a></td>
                            </tr>    
                        </table><!-- End sub feature table left -->        
                    </td>
                    <td width="20"></td>
                    <td width="265">
                    <!-- Sub feature table right -->
                        <table cellspacing="0" cellpadding="0" width="265" bgcolor="#ffffff" align="center">
                            <tr>
                                <td width="265"><img src="linktoimage" alt="Mother's Day Treat" title="Mother's Day Treat" width="265" height="140" /></td>
                            </tr>
                            <tr>
                                <td height="15" width="265"></td>
                            </tr>
                            <tr>
                                <td width="265"><p style="font-size: 17px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: bold; color: #350d03; margin: 0px 0px 0px 0px; text-transform: uppercase;">Easter Special Offer!</p></td>
                            </tr>
                            <tr>
                                <td height="10" width="265"></td>
                            </tr> 
                            <tr>
                                <td width="265"><p style="font-size: 13px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #7a7a7a; margin: 0px 0px 0px 0px;">Stay in the 4 star Western House Hotel for 2 nights for only &pound;135 per night and 3 nights for only &pound;125 per night**!</p></td>
                            </tr>
                            <tr>
                                <td height="25" width="265"></td>
                            </tr>   
                            <tr>
                                <td><a href="http://www.example.co.uk" target="_blank"><img src="linktoimage" alt="Book Now!" title="Book Now!" border="0" width="114" height="27" /></a></td>
                            </tr>    
                        </table><!-- End sub feature table right -->
                    </td>
                    <td width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td height="25" width="25"></td>
                    <td height="25" width="550" colspan="3" align="center"><img src="linktoimage" alt="Page divide" width="548" height="18" /></td>
                    <td height="25" width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td height="25" width="25"></td>
                    <td height="25" width="550" colspan="3" align="left"><p style="font-size: 13px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: bold; color: #350d03; margin: 0px 0px 0px 0px;">Terms and conditions</p></td>
                    <td height="25" width="25"></td>
                </tr>
                <tr>
                    <td height="25" width="25"></td>
                    <td height="25" width="550" colspan="3" align="left"><p style="font-size: 11px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #7a7a7a; margin: 0px 0px 0px 0px;">* Based on two guests sharing. ** Per room per night on a dinner, bed and breakfast basis, based on two guests sharing. Subject to availability. Upgrades available.</p></td>
                    <td height="25" width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->                   
            </table><!-- End main content table -->                                     
        </td><!-- End main holding table data -->
    </tr><!-- End main holding table row -->                                  
</table> <!-- End main holding table --> 

<!-- Footer spacer table -->
<table cellspacing="0" cellpadding="0" border="0" width="100%" bgcolor="#350d03">
    <tr><!-- Footer spacer table row -->
        <td><!-- Footer spacer table data -->
            <!-- Spacer table -->
            <table cellspacing="0" cellpadding="0" width="600" bgcolor="#350d03" align="center">
                <tr><!-- Spacer row -->
                    <td height="30" width="600"></td>
                </tr><!-- End spacer row -->
            </table><!-- End spacer table -->
        </td><!-- End footer spacer table data -->
    </tr><!-- End footer spacer table row -->
</table><!-- End footer spacer table -->

<!-- Footer holding table -->
<table cellspacing="0" cellpadding="0" border="0" width="100%" bgcolor="#210401">
    <tr><!-- Footer holding table row -->
        <td><!-- Footer holding table data -->
            <!-- Footer table -->
            <table cellspacing="0" cellpadding="0" width="600" bgcolor="#210401" align="center">
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td height="30" width="25"></td>
                    <td height="30" width="265">
                        <!-- Connect table -->
                        <table cellspacing="0" cellpadding="0" width="265" bgcolor="#210401" align="center">    
                            <tr>
                                <td width="265" colspan="3"><p style="font-size: 20px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #bb8d09; margin: 0px 0px 0px 0px;">Connect with Us</p></td>
                            </tr> 
                            <tr><!-- Spacer row -->
                                <td height="20" width="25"></td>
                                <td height="20" width="15"></td>
                                <td height="20" width="225"></td>
                            </tr><!-- End spacer row -->
                            <tr>
                                <td width="25"><img src="linktoimage" alt="Find us on Facebook" title="Find us on Facebook" width="25" height="25" /></td>
                                <td width="15"></td>
                                <td width="225"><p style="font-size: 12px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #ffffff; margin: 0px 0px 0px 0px;"><a href="http://www.example.co.uk" target="_blank" title="Find us on Facebook" style="color: #ffffff; text-decoration: none;">facebook.com/westernhousehotel</a></p></td>
                            </tr> 
                            <tr><!-- Spacer row -->
                                <td height="10" width="25"></td>
                                <td height="10" width="15"></td>
                                <td height="10" width="225"></td>
                            </tr><!-- End spacer row -->
                            <tr>
                                <td width="25"><img src="http://www.example.co.uk" alt="Follow us on Twitter" title="Follow us on Twitter" width="25" height="25" /></td>
                                <td width="15"></td>
                                <td width="225"><p style="font-size: 12px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #ffffff; margin: 0px 0px 0px 0px;"><a href="http://www.example.co.uk" target="_blank" title="Follow us on Twitter" style="color: #ffffff; text-decoration: none;">twitter.com/westernhouseayr</a></p></td>
                            </tr> 
                        </table><!-- End connect table -->  
                    </td>
                    <td height="30" width="20"></td>
                    <td height="30" width="265">
                    <!-- Connect table -->
                        <table cellspacing="0" cellpadding="0" width="265" bgcolor="#210401" align="center">    
                            <tr>
                                <td width="265" colspan="3"><p style="font-size: 20px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #bb8d09; margin: 0px 0px 0px 0px;">Contact Us</p></td>
                            </tr> 
                            <tr><!-- Spacer row -->
                                <td height="20" width="25"></td>
                                <td height="20" width="15"></td>
                                <td height="20" width="225"></td>
                            </tr><!-- End spacer row -->
                            <tr>
                                <td height="25" width="225" colspan="3"><p style="font-size: 12px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #ffffff; margin: 0px 0px 0px 0px;">01292 294990</p></td>
                            </tr> 
                            <tr><!-- Spacer row -->
                                <td height="10" width="25"></td>
                                <td height="10" width="15"></td>
                                <td height="10" width="225"></td>
                            </tr><!-- End spacer row -->
                            <tr>
                                <td height="25" width="225" colspan="3"><p style="font-size: 12px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #ffffff; margin: 0px 0px 0px 0px;"><a href="http://www.example.co.uk" target="_blank" title="Send us an Email" style="color: #ffffff; text-decoration: none;">info@westernhousehotel.co.uk</a></p></td>
                            </tr> 
                        </table><!-- End connect table -->
                    </td>
                    <td height="30" width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="30" width="25"></td>
                    <td height="30" width="265"></td>
                    <td height="30" width="20"></td>
                    <td height="30" width="265"></td>
                    <td height="30" width="25"></td>
                </tr><!-- End spacer row -->
                <tr>
                    <td height="20" width="25"></td>
                    <td height="20" width="500" colspan="3" align="center"><p style="font-size: 12px; font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: normal; color: #ffffff; margin: 0px 0px 0px 0px;">Western House Hotel | Craigie Road | Ayr, South Ayrshire | Scotland | KA7 0HA</p></td>
                    <td height="20" width="25"></td>
                </tr>
                <tr><!-- Spacer row -->
                    <td height="20" width="25"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="20"></td>
                    <td height="20" width="265"></td>
                    <td height="20" width="25"></td>
                </tr><!-- End spacer row -->
            </table><!-- End footer table -->
        </td><!-- End footer holding table data -->
    </tr><!-- End footer holding table row -->
</table><!-- End footer holding table -->                       


</body>
</html>

谢谢。

4

2 回答 2

1

您需要在 Outlook 中查看页面的代码。它会很乱,但它至少会告诉你为什么</td>'s 漂浮在那里。那里可能有一个混乱的跨度或其他东西。

从那里你只需要排除故障,尝试以下一些:

  • 设置你的字符集<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  • 试试<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">doctag

如果这不起作用,请尝试:

  • 删除<p>标签并<br>在问题发生的地方使用 's 以查看 Outlook 处理是否不同

  • 尝试缩短您的电子邮件,使错误部分保持不变,看看它是否与您的代码长度有关

并不是说这些东西总是必要的,但是您需要隔离 Outlook“不喜欢”的内容,即使按照正常的 Web 标准,该解决方案看起来很愚蠢。

于 2013-02-08T16:09:26.990 回答
0

您是否尝试过仅发送正文的内部 html?我只是将其添加为评论,但显然在我获得更高的声誉之前我不能。我尝试发送内部 html,但通过 Powershell 没有任何多余的标签。你到底是怎么寄的?

于 2013-02-07T13:46:17.510 回答