简体   繁体   English

带有html的php邮件功能在交换中未正确显示

[英]php mail function with html not shown correct in exchange

I got a strange problem with php mail and exchange. 我在php邮件和交换中遇到了一个奇怪的问题。 When I use the a simple php html mailscript, see below (can be found all over internet) I see the mail as kind of plain text (see below) mail in Microsoft Exchange. 当我使用简单的php html邮件脚本时,请参见下文(可以在Internet上找到所有邮件),在Microsoft Exchange中,我将邮件视为纯文本邮件(请参见下文)。 But when I send the mail to an other account with Outlook I see the mail as a HTML-mail as it should be. 但是,当我使用Outlook将邮件发送到另一个帐户时,我将其视为应有的HTML邮件。

Doest anybody got a clue? 有人知道了吗?

Mailscript: Mailscript:

<?php
// multiple recipients
$to  = 'aidan@example.com' . ', '; // note the comma
$to .= 'wez@example.com';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
  <title>Birthday Reminders for August</title>
</head>
<body>
  <p>Here are the birthdays upcoming in August!</p>
  <table>
    <tr>
      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
    </tr>
    <tr>
      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
    </tr>
    <tr>
      <td>Sally</td><td>17th</td><td>August</td><td>1973</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";

// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>

View in Exchange: 在Exchange中查看:

Content-type: text/html; charset=iso-8859-1

From: Birthday Reminder <birthday@example.com>
Subject:Birthday Reminders for August

Return-Path: root@server2.nedstars.nl
X-OriginalArrivalTime: 06 Oct 2010 13:39:59.0117 (UTC) FILETIME=[F839FBD0:01CB655B]

<html>
    <head>
      <title>Birthday Reminders for August</title>
    </head>
    <body>
      <p>Here are the birthdays upcoming in August!</p>
      <table>
        <tr>
          <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
        </tr>
        <tr>
          <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
        </tr>
        <tr>
          <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
        </tr>
      </table>
    </body>
    </html>

尝试将标题中的"\\r\\n"替换为"\\n"

Have you tried using Content-Type instead of Content-type ? 您是否尝试过使用Content-Type而不是Content-type (capitalize the type ) (大写type

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM