HTML电子邮件中的感叹号 [英] Exclamation Point in HTML Email

查看:209
本文介绍了HTML电子邮件中的感叹号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难在HTML电子邮件中格式化表格。似乎总是有一个单元格没有背景颜色或奇怪的空格。

I am having a hard time formatting a table in an HTML email. There seems to always be one cell that doesn't have the background color or weird white spaces.

这里是代码(在php中) -

Here is the code (in php) -

 $subject.="<br/><br/><table style=\"width:585px;\" ><tr><td style=\"padding:10px;background-color:#113797;color:white;\">New & Used Vehicles</td><td style=\"padding:10px;background-color:#113797;color:white;\">Term in Months</td><td style=\"padding:10px;background-color:#113797;color:white;\">APR* As Low As</td><td style=\"padding:10px;background-color:#113797;color:white;\">Monthly Payment Per $1000 Borrowed</td></tr>";       
    $result = mysql_query("SELECT * FROM rates WHERE ID>='32' AND ID <='39'");
        while($row = mysql_fetch_array($result))
    {
                  $subject.= "<tr><td BGCOLOR=\"#e5f1ff\" style=\"padding:10px;color:black;\">" . $row['name'] . "</td>";
                  $subject.= "<td BGCOLOR=\"#e5f1ff\" style=\"padding:10px;\">" . $row['term'] . "</td>";
                  $subject.= "<td BGCOLOR=\"#e5f1ff\" style=\"padding:10px;\">" . $row['apr'] . "</td>";
                  $subject.= "<td BGCOLOR=\"#e5f1ff\" style=\"padding:10px;\">" . $row['per_1000'] . "</td></tr>";
    }

 $subject.= "</table>";

所以我已经尝试了两个CSS背景和html,并且都创建看起来不好的东西。我也尝试过Doctypes。

So I've tried both css background and html and both create something that looks bad. I've also tried Doctypes.

这是我邮件代码的样子。

This is what my mail code looks like.

    mail( "XXXXXX@yahoo.com", "$title2", "$subject" , "Content-type: text/html;\r\nFrom: auto-alerts@streatoronized.org" );

这是它渲染出来的东西。看到流氓空间?

Here is what it renders out like. See the rogue space?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>Check out the low rates.<table style="width:585px;" ><tr><td style="padding:10px;background-color:#113797;color:white;">New &amp; Used Vehicles</td><td style="padding:10px;background-color:#113797;color:white;">Term in Months</td><td style="padding:10px;background-color:#113797;color:white;">APR* As Low As</td><td style="padding:10px;background-color:#113797;color:white;">Monthly Payment Per $1000 Borrowed</td></tr><tr><td bgcolor="#e5f1ff" style="padding:10px;color:black;height:100%;">2008 and NEWER Vehicle Purchases</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">Up to 72 Months</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">3.24%</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">$17.28</td></tr><tr><td bgcolor="#e5f1ff" style="padding:10px;color:black;height:100%;">2008 and NEWER Vehicle!
  Purchases</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">64 - 72 Months</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">4.29%</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">$15.69</td></tr><tr><td bgcolor="#e5f1ff" style="padding:10px;color:black;height:100%;">2007 and OLDER Vehicle Purchases</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">Up to 72 Months</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">5.49%</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">$18.20</td></tr><tr><td bgcolor="#e5f1ff" style="padding:10px;color:black;height:100%;">2007 and OLDER Vehicle Purchases</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">64 - 72 Months</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">5.99%</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">$16.46</td></tr><tr><td bgcolor="#e5f1ff" style="padding:10px;color:black;height:100%;">2011 &amp; 2010 REFINANCES</td><td bgcolor=!
 "#e5f1ff" style="padding:10px;height:100%;">Up to 63 Months</t!
 d><td bg
color="#e5f1ff" style="padding:10px;height:100%;">4.99%</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">$18.08</td></tr><tr><td bgcolor="#e5f1ff" style="padding:10px;color:black;height:100%;">2011 &amp; 2010 REFINANCES</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">64 - 72 Months</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">5.49%</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">$16.34</td></tr><tr><td bgcolor="#e5f1ff" style="padding:10px;color:black;height:100%;">2008 - 2009 REFINANCES</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">Up to 60 Months</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">5.99%</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">$19.33</td></tr><tr><td bgcolor="#e5f1ff" style="padding:10px;color:black;height:100%;">2007 &amp; older Vehicle REFINANCE</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">Up to 60 Months</td><td bgcolor="#e5f1ff" style="padding:10px!
 ;height:100%;">6.99%</td><td bgcolor="#e5f1ff" style="padding:10px;height:100%;">$19.80</td></tr></table></body></html>


推荐答案

我讨厌回答自己的问题,解决问题,希望有人可以使用这种解决方案来摆脱这个原因造成的头痛。

I hate to answer my own question but I did find a resolution to the issue, and hopefully someone can use this solution to get rid of the headaches this causes.

问题是由于使用mail()函数造成的。当我尝试发送电子邮件时,我有一长串HTML代码。 事实上,太长了!当我超过78个字符时,一个 BANG!显示,然后使用我的html或css插入。 RFC 2822

The issue is being caused by use of the mail() function. When I try to send the email, I have a long string of html code. IN FACT, TOO LONG! When I go past 78 characters a BANG! shows up and then jacks with my html or css. RFC 2822

分辨率为将其更改为base-64编码数据或在我的长行HTML代码中添加\r\\\
。任何一种方式都可以解决问题。

The resolution is to change it to base-64 encode the data or add \r\n on my long lines of html code. Either way resolves the issue.

感谢大家的帮助!

这篇关于HTML电子邮件中的感叹号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆