bonjour,
j'ai un formulaire php sur un site qui permet d'envoyer une newsletter à nos membre, en html ou texte selon leur préférence.

tout est ok dans tous les clients mail et les webmails, sauf outlook (2003/2007) et windows mail, qui affichent le code html en tant que texte brut (il affiche les balises).

je fais bien du multipart, tout semble ok (puisque les autres clients interprètent bien le html).

quelqu'un a-t-il une piste pour m'aider, svp ?

merci d'avance !


voilà la partie de code qui peut être en cause selon moi :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
	if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
	  $eol="\r\n";
	} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
	  $eol="\r";
	} else {
	  $eol="\n";
	} 
	$headers = "";
	# Common Headers
	$headers .= "From: ".$sender.$eol;
	$headers .= "Reply-To: ".$sender.$eol;
	$headers .= "Return-Path: ".$sender.$eol;    // these two to set reply address
	$headers .= "Message-ID: <".date("Y/m/d H:i:s")." TheSystem@".$_SERVER["SERVER_NAME"].">".$eol;
	$headers .= "X-Mailer: PHP v".phpversion().$eol;          // These two to help avoid spam-filters
 
	# Boundry for marking the split & Multitype Headers
	$mime_boundary=md5(time());
	$headers .= "MIME-Version: 1.0".$eol;
	$headers .= "Content-Type: multipart/related; boundary=\"$mime_boundary\"".$eol;
	$msg = "";
 
	# Setup for text OR html -
	$msg .= "--".$mime_boundary.$eol;
	$htmlalt_mime_boundary = $mime_boundary."_htmlalt"; //we must define a different MIME boundary for this section for the alternative to work properly in all email clients
	$msg .= "Content-Type: multipart/alternative; boundary=\"$htmlalt_mime_boundary\"".$eol;
 
	# Text Version
	$msg .= "--".$htmlalt_mime_boundary.$eol;
	$msg .= "Content-Type: text/plain; charset=iso-8859-1".$eol;
	$msg .= "Content-Transfer-Encoding: 8bit".$eol;
	$msg .= "This is a multi-part message in MIME format.".$eol;
	$msg .= "If you are reading this, please update your email-reading-software.".$eol;
	$msg .= "+ + Text Only Email from Genius Jon + +".$eol.$eol;
 
	# HTML Version
	$msg .= "--".$htmlalt_mime_boundary.$eol;
	$msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
	$msg .= "Content-Transfer-Encoding: 8bit".$eol;
	$msg .= $body.$eol.$eol;
 
	//close the html/plain text alternate portion
	$msg .= "--".$htmlalt_mime_boundary."--".$eol.$eol;
 
	# Finished
	$msg .= "--".$mime_boundary."--".$eol.$eol;
 
	# SEND THE EMAIL
 
	$envoi = mail('moi@monsite.com', $emailsubject, $msg, $headers);