English 中文(简体)
传真:电子邮箱:Exclamation Point
原标题:Exclamation Point in HTML Email

我很难用超文本的电子邮件表格式。 似乎总是有一间囚室,它有背景的肤色或湿度的白色空间。

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>";

因此,我既尝试了背景,又尝试了html,两者都制造了坏的东西。 我也尝试了多式。

这就是我的邮件法。

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

这里正是它使情况变得如此。 见流ogue空间?

Table that is messed up!

<!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>
最佳回答

我怀着仇恨回答我自己的问题,但我确实找到了解决这一问题的办法,希望有人能够利用这一解决办法来消除这一根源。

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

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

感谢大家的帮助!

问题回答

Seems there is not a return on the offending cells So try adding height:100% to them so they are fully filled. You could fix this by adjusting this code

<td style="padding:10px;background-color:#113797;color:white;">

To

<td style="padding:10px;background-color:#113797;color:white;height:100%;">

这应当解决你的问题。

移除所有CSS的捆绑,许多电子邮件使发动机失效。 使用便衣原表设计。

使用<代码><font Gul=“black”>blah</font>,而不是风格color/code>,使用<代码><table cellpaids=“10”>代替patter/code>。

c 整个TABLE,而不是TDs。

Here is a example of how to create a Base64 Encoded Email in:

    <?php 

$html = "<p>The <b>quick</b> <em>brown</em> <u>fox</u> jumped right over the lazy dog.</p><hr />";

$to   = "amit@labnol.org";
$cc   = "cc@labnol.org";
$bcc  = "bcc@labnol.org";
$from = "from@labnol.org";

$subject  = "This is a MIME encoded email";
$boundary = str_replace(" ", "", date( l jS of F Y h i s A ));
$newline  = "
";

$headers = "From: $from$newline".
           "Cc: $cc$newline".
           "Bcc: $bcc$newline".
           "MIME-Version: 1.0$newline".
           "Content-Type: multipart/alternative;".
           "boundary = "$boundary"$newline$newline".
           "--$boundary$newline".
           "Content-Type: text/html; charset=ISO-8859-1$newline".
           "Content-Transfer-Encoding: base64$newline$newline";

$headers .= rtrim(chunk_split(base64_encode($html)));

mail($to,$subject,"",$headers);

?>

I found this code in the following site :

https://ctrlq.org/code/19840-base64-encoded-email

Setting up your emails to be Based64 Encoded will remove the random ! being added to emails.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!