【发布时间】:2014-08-08 17:02:12
【问题描述】:
我有带有表格的 php/html 代码。它在 yahoo、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" ." " ."£" .$_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>";
【问题讨论】:
-
尝试将 min-width:595px 添加到您的全角 td 之一。 Gmail 不遵循常规宽度样式,似乎只遵循单元格上的 min-width。
-
感谢@Narong 的评论。不幸的是,它没有解决它。
标签: php css html-table gmail html-email