当我使用 PHP 邮件通过文件发送一封非常基本的 HTML 电子邮件时,它对我来说非常完美。但对于我的客户,他会看到电子邮件中的所有 HTML 标签。
我有自己的专用服务器,为了解决问题,我从我拥有的 Heart Internet 共享服务器运行完全相同的文件,并且电子邮件完美地显示给我的客户端(没有 HTML 标签),因此它指向与服务器有关的事情。
<?php
$to = 'tom@myemailaddress.com';
$subject = 'TOM Testing: HTML displaying correctly?';
$message = '
<html>
<head>
<title>This is a test</title>
</head>
<body>
<p>To see if</p>
<table>
<tr>
<th>You</th><th>See</th><th>The</th><th>HTML</th>
</tr>
<tr>
<td>or</td><td>it</td><td>is</td><td>formatted</td>
</tr>
<tr>
<td>correctrly</td><td>1</td><td>2</td><td>abc</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
?>
这是我的 php 信息: http: //www.saloponline.co.uk/phpinfo.php