Php Gmail应用程序显示字体大小和颜色错误

Php Gmail应用程序显示字体大小和颜色错误,php,css,html-table,gmail,html-email,Php,Css,Html Table,Gmail,Html Email,我有带表的php/html代码。它在雅虎、gmail等网站上看起来很不错,但在手机上打开gmail应用程序时,它会被奇怪的绿色和错误的字体大小弄得一团糟。你知道怎么解决这个问题吗?下面的链接由2个屏幕截图组成。左边的一个是它在包括gmail在内的所有电子邮件帐户上的外观。右边是它在iPhone上的gmail应用程序上的外观 代码如下: <?php // Fixes the encoding to uf8 function fixEncoding($in_str) { $cur

我有带表的php/html代码。它在雅虎、gmail等网站上看起来很不错,但在手机上打开gmail应用程序时,它会被奇怪的绿色和错误的字体大小弄得一团糟。你知道怎么解决这个问题吗?下面的链接由2个屏幕截图组成。左边的一个是它在包括gmail在内的所有电子邮件帐户上的外观。右边是它在iPhone上的gmail应用程序上的外观

代码如下:

<?php 
// Fixes the encoding to uf8 
function fixEncoding($in_str) 
{ 
  $cur_encoding = mb_detect_encoding($in_str) ; 
if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) 
return $in_str; 
else 
return utf8_encode($in_str); 
} // fixEncoding 
?>
<?php


require_once('class.phpmailer.php');

//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not     already loaded

$mail             = new PHPMailer();

$body = '<html><body>';
$body .= '<table rules="all" style="border-color: #fff; font-family: Arial; width:595px;     height:108px; font-size:115%; background-color:#ffffff;" cellpadding="10">';
$body .= "<tr><td style='text-align: center; text-align: middle; vertical-align: middle;      vertical-align: center'>
 <img style='border: 0px solid ;     'src='http://www.magentastorage.co.uk/mobile/images/emailheader.jpg'></a> </td></tr>";

 $body .= '</table>';

 $body .= '<table rules="all" style="border-color: #fff; font-family: Arial; width:595px; font-size:115%; background-color:#ffffff;" cellpadding="10"; position:relative; left:"20">';

$body .= "<tr><td style= 'padding-left:21px;'>Dear  " .$_GET["name"] ."," . "</td></tr>";
$body .= "<tr><td style= 'padding-left:21px;'>Thank you for visiting our website and contacting us about your storage requirements. Below is a summary of your storage quotation:  </td></tr>";
$body .= "<tr> <td style='text-align: left; font-family: Arial; vertical-align: left;'>
 <img style='border: 0px solid ; ' src='http://www.magentastorage.co.uk/mobile/images/emailrequirements.png'> </td></tr>";

$body .= '</table>';

$body .= '<table rules="all" style="border-color: #fff; font-family: Arial; width:470px; font-size:115%; background-color:#ffffff;" cellpadding="10">';

    $body .= "<tr>";
$body .= "<td style= 'padding-left:21px;'>Unit Size:</td>";
$body .= "<td>";
$body .= $_GET["unitsize"];
$body .= "</td>";
$body .= "<td></td>";
$body .= "</tr>";


    $body .= '</table>';

$body .= '<table rules="all" style="border-color: #fff; font-family: Arial; width:595px; font-size:115%; background-color:#ffffff;" cellpadding="10">';

$body .= "<tr> <td style='text-align: left; font-family: Arial; vertical-align: left;'>
 <img style='border: 0px solid ; '
 src='http://www.magentastorage.co.uk/mobile/images/emailquotation.png'> </td></tr>";
$body .= "<tr><td style= 'padding-left:21px;'>" ."Weekly rental is" ." " ."&pound;" .$_GET["price"] ." "     ."</td> </tr>";
$body .= "<tr><td style= 'padding-left:21px;'>This quote includes VAT, insurance cover for up to" ." " ."£" .$_GET["insurance"] ." " ."and a padlock to secure your storage unit</td></tr>";
$body .= "<tr><td style= 'padding-left:21px;'>" ."<strong>" ."**4 WEEKS FREE STORAGE**" ."</strong>" ."</td>";
$body .= "<tr><td style= 'padding-left:21px;'>Simply pay for 4 weeks storage when you move in and we'll give you an extra 4 weeks storage completely free!</td></tr>";

$body .= "<tr><td style= 'padding-left:21px;'>Kind Regards, </td></tr>";
$body .= "<tr><td style= 'padding-left:21px;'>Store Manager </td></tr>";

$body .= "</table>";
$body .= "</body></html>";


我对PHP的知识还不够渊博,无法给您提供任何提示,但我发现静态HTML位有很多问题

<td style='text-align: center; text-align: middle; vertical-align: middle;      vertical-align: center'>
只需创建整个边框,而不是
边框颜色:#fff
<代码>边框:3倍实心#ffffff
。您有
位置:相对;左:“20”
在样式声明之外,因此它们应该被移动。此外,还需要为
left
值添加一个单位,并删除
cellpadding=“10”中的分号


不能将“垂直对齐”设置为“左”

此外,在处理电子邮件时,最好使用完整的6字符十六进制代码<代码>边框:0px实心
可以替换为
边框:0
。我还建议使用绝对字体大小,而不是相对百分比


再说一次,我不知道你的PHP有多可靠,但是看到你的HTML/CSS中有很多错误,我建议把它们整理一下,你的电子邮件可能会表现得更好。

尝试在你的全宽td中添加最小宽度:595px。Gmail不遵循常规的宽度样式,似乎只遵循手机的最小宽度。谢谢@Narong的评论。不幸的是,它没有修复它。谢谢@Narong,但仍然没有运气。嗯。。你能从Gmail中获取并共享源HTML吗?我不知道如何在Gmail应用程序中实现这一点,但是如果它要发送到Gmail地址,你可以点击回复箭头旁边的三角形->show original,从网站上获取代码
<table rules="all" style="border-color: #fff; font-family: Arial; width:595px; font-size:115%; background-color:#ffffff;" cellpadding="10"; position:relative; left:"20">
<td style='text-align: left; font-family: Arial; vertical-align: left;'>