2010-10-07 81 views
1

我有一個奇怪的問題與PHP郵件和交流。當我使用簡單的php html郵件標記時,請參閱下面的內容(可以在互聯網上找到)我在Microsoft Exchange中將郵件視爲純文本郵件(見下文)。但是,當我使用Outlook將郵件發送到其他帳戶時,我會將郵件視爲HTML郵件。PHP郵件功能與html沒有顯示正確的交換

有沒有人有線索?

Mailscript:

<?php 
// multiple recipients 
$to = '[email protected]' . ', '; // note the comma 
$to .= '[email protected]'; 

// 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 <[email protected]>, Kelly <[email protected]>' . "\r\n"; 
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; 
$headers .= 'Cc: [email protected]' . "\r\n"; 
$headers .= 'Bcc: [email protected]' . "\r\n"; 

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

查看在Exchange:

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

From: Birthday Reminder <[email protected]> 
Subject:Birthday Reminders for August 

Return-Path: [email protected] 
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> 
+0

你解決這個問題了嗎? – 2010-10-07 17:48:08

回答

3

嘗試更換"\r\n""\n"在頭

+0

好吧,我會回家時嘗試它。但奇怪的是,它工作了1。5年,並且昨天它給了問題 – Megapool020 2010-10-07 05:51:20

+0

什麼是發送郵件的機器的類型? – 2010-10-07 05:52:08

+0

這是一個在荷蘭託管的網絡服務器 – Megapool020 2010-10-07 05:54:02

0

您是否嘗試過使用Content-Type,而不是Content-type? (大寫type

+0

好吧,我回家後會試試。但奇怪的是,它工作了1。5年,昨天它給了問題 – Megapool020 2010-10-07 05:57:04