2010-10-07 1 views
1

J'ai eu un problème étrange avec le courrier et l'échange php. Lorsque j'utilise un simple mailmail php html, voir ci-dessous (peut être trouvé partout sur internet) Je vois le courrier comme un type de texte brut (voir ci-dessous) mail dans Microsoft Exchange. Mais quand j'envoie le mail à un autre compte avec Outlook, je vois le mail comme un mail HTML comme il se doit.Fonction de messagerie php avec html non affiché correct en échange

Quelqu'un aurait-il une idée?

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); 
?> 

Voir dans 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

vous résoudre ce problème encore? –

Répondre

3

essayer de remplacer le "\r\n"-"\n" dans les en-têtes

+0

Ok, va essayer quand je rentre à la maison.Mais chose étrange est que cela a fonctionné pendant 1,5 ans, et hier, il a donné des problèmes – Megapool020

+0

quel est le type de la machine qui envoie le courrier? –

+0

C'est un serveur web hébergé aux Pays-Bas – Megapool020

0

Avez-vous essayé d'utiliser Content-Type au lieu de Content-type? (Le capitalisent type)

+0

Ok, va essayer quand je rentre à la maison.Mais chose étrange est que cela a fonctionné pendant 1,5 ans, et hier, il a donné des problèmes – Megapool020