【问题标题】:Cannot send table format to gmail using PHPmailer.无法使用 PHPmailer 将表格格式发送到 gmail。
【发布时间】:2014-10-10 22:33:05
【问题描述】:

我使用 MsgHTML() 函数发送此邮件正文。 isHTML 在邮件脚本中启用。 像
这样的 HTML 标签在邮件中呈现,内联样式也有效。 但该表未在 gmail 中呈现。显示纯文本的收件箱。图像显示清晰。

PHP 代码

$pd_details.='  
<table > 
  <th>Prod no  |</th>  <th>Prod name   |</th> <th>Prod price   |</th> <th>Prod quantity   |</th> <th>Prod image   |</th>
      <tr><td>'.$c.'</td><td>'.$pname.'</td><td>'.$total.'</td><td>'.$quant.'</td<td>'.$pdimg.'</td></tr>
</table>

Total Price is : '.$sum.' ';

【问题讨论】:

  • 确保他的整个邮件正文都是有效的html
  • @Dagon 这是什么意思??看不懂。
  • 是的,也许你有一些 html 错误,所以 gmail 无法呈现它。
  • @Dagon 我不这么认为,伙计。因为其他 HTML 标题需要换行标记工作正常。
  • 就像他说的那样validate your HTML!首先,您的ths 周围缺少tr

标签: php phpmailer


【解决方案1】:
Try this...  

                $from='sender details';  
                $to='receiver email address';  
                $headers .= 'MIME-Version: 1.0' . "\r\n";  
                $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";  
                $headers .= 'From:'.$from. "\r\n";  

                $body='<table > 
      <th>Prod no  |</th>  <th>Prod name   |</th> <th>Prod price   |</th> <th>Prod quantity   |</th> <th>Prod image   |</th>
          <tr><td>'.$c.'</td><td>'.$pname.'</td><td>'.$total.'</td><td>'.$quant.'</td<td>'.$pdimg.'</td></tr>
    </table>';  

                $subject="subject";  
                ini_set("sendmail_from",$from);  
                @mail($to,$subject,$body,$headers);  

【讨论】:

    猜你喜欢
    • 2023-03-28
    • 2016-08-29
    • 2015-05-01
    • 1970-01-01
    • 2015-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多