Bonjour je récupére via php le contenu d'un mail . Si le mail est en texte brut pas de probème,mais problème si mail en html

a la base le texte a recupérer est

" 8.665203,-79.092164, test bateau"

tout ca est noyé dans le fichier data.txt si dessous



===================== fichier data.txt=========================

27-06-2013,16:45,This is a multipart message in MIME format. ------_NextPart_000_0136_01CE7354.F3342110 Content-Type: text/plain; charset"us-ascii" Content-Transfer-Encoding: 7bit 8.665203,-79.092164, test bateau ------_NextPart_000_0136_01CE7354.F3342110 Content-Type: text/html; charset"us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:v"urn:schemas-microsoft-com:vml" xmlns:o"urn:schemas-microsoft-com:office:office" xmlns:w"urn:schemas-microsoft-com:office:word"

========================================================




recup du mail

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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 
<?php
	$imapLink = imap_open("{mail.planet-xx.com:110/pop}","maigfr@-position.fr","santdfgt");
 
 
 
if(!$imapLink)
	{
		echo "La connexion a échouée.";
	}
	else
	{
		echo "Connexion établie, lecture des messages :<br />";
 
		$mailBoxInfos = imap_check($imapLink);
 
 
	echo 'Version 2 :';
 
		$num = imap_num_msg($imapLink);
 
 
 
 
 
		if($num > 0) 
		{
			echo imap_qprint(imap_body($imapLink, $num));
 
 
$corps= imap_qprint(imap_body($imapLink, $num));
 
 $corps= preg_replace("/(\r\n|\n|\r)/", " ", $corps);
 
 
 
echo"<br>";
echo"<br>";
echo"<br>";
echo"<br>";
		} 
 
		imap_close($imapLink);
		echo "Fermeture de la connexion.";
	}
 
 
 
if (empty($corps))
 
{
echo"<br>";
 
exit("PAS D ECRITURE DANS LE FICHIER CELUI CI EST VIDE");
 
 
}
 
else
 
{
 
 
 
 
echo"$corps";
 
 
 
$date = date("d-m-Y");
$heure = date("H:i");
 
 
 
$data="$date,$heure,$corps\n";
 
 
 
 
 
 
if(strstr($data, '=')) 
$data = str_replace('=', '', $data); 
 
 
 
 
$fp = fopen("data.txt","w");
    fwrite($fp,"$data");
   fclose($fp);
 
 
 
?>