Bonjour,

J'ai un code mais voudrais l'adapter au localhost qq un peut-il m'aider svp ?

Voici le code quelle sont les lignes à remplacer svp ?
info j 'utilise outlok express comme messagerie.

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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>Liste mail</title>
		<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
		<meta name="description" content="" />
		<meta name="robots" content="all" />
	</head>
	<body>
		<?php
 
		//Fonction qui permet de rechercher selon une adresse mail et un mot de passe les mails correspondant et de les affiicher
		//Affiche, le numero du mail, la date, l'expéditeur et le sujet (lien pour ouvrir le mail).
		//Et les piéces jointes (lien sur le OUI qui permet d'enregistrer sur l'ordinateur et de les visualiser)
 
			function lecture_mail($boite,$serveur_entrant,$port,$protocole,$identifiant,$mot_de_passe)
			{
				$boite = "INBOX";
				$serveur_entrant = "pop3.bee-post.com";
				$port = "110";
				$protocole = "pop3";
				$identifiant = "";
				$mot_de_passe = "";
 
				//on ouvre la boite mail
				$mail = imap_open ( "{pop3.bee-post.com:110/pop3}INBOX" , $identifiant , $mot_de_passe );
 
				//Nombre de message dans la boite mail
				$nbmess = imap_num_msg($mail);
				//Recherche et affichage de chaque message
				if($nbmess == 0)
				{
					//Si il n'y a aucun mail
					print"
						<div align='center'>
							<b>Aucun message présent sur le serveur</b>
							<br /><br />
						</div>
					";
				}
				else
				{
					//Si y a au moins un mail
					print"
						<div align='center'>
							<b>Bienvenue sur la consultation de mail $identifiant.</b>
							<br /><br />
							<b>Vous avez $nbmess message(s) en attente.</b>
							<br /><br />
						</div>
					";
			?>
			<!-- Tableau qui regroupe les différents éléments qui constitu le mail -->
				<center><table>
					<tr>
						<th width="30px">n°</th>
						<th width="250px">Qui l'as envoyé</th>
						<th width="280px">Date</th>
						<th width="275px">Sujet</th>
						<th width="200px">Piéce(s) jointe(s)</th>
						<th width="110px">Suppression</th>
					</tr>
				</table><center>
			<?php
					for($j=1;$j<=$nbmess;$j++)
					{
						//Extraction du sujet du message
						$header = imap_headerinfo($mail,$j);
						//Extraction de la premiére partie du mail
						$from1 = $header->from[0]->mailbox;
						//Extraction de la seconde partie
						$from2 = $header->from[0]->host;
						//Mise en forme du mail de l'expéditeur
						$from = $from1 .'@'. $from2;
						//var_dump ($header->from);
						$date = $header->date;
						$sujet = $header->subject;
 
						//extraction de la structure du message
						$struct = imap_fetchstructure($mail,$j);
 
 
						// On compte le nombre de partie dans la structure du message
						if ($struct->type == 1)
						{
							$nbrparts = !$struct->parts ? "1" : count($struct->parts);
						}
						//On place le code binaire de la pièce dans un tableau
						$piece = array();
 
						$part = $struct->parts[1] ;
 
						//Extraction du code binaire de la pièce jointe
						$piece = imap_fetchbody($mail,$j,$h);
 
						//Le 3 est spécifique à l'encodage en base64 (le plus répandu) pour les pièces jointes.
						if ($part->encoding == "3")
						{
							//Comptage du nombre de parametres
							$nbparam = count($part->parameters);
 
								//Récupération du nom de la pièce jointe
								$param = $part->parameters[0];
								//var_dump ($param);
								if ($param->attribute == "NAME")
								{
									$nom_fichier = $param->value;
								}
								else
								{
									$nom_fichier = "Nom de fichier introuvable";
								}
							//Décodage du code binaire de la pièce jointe
							$piece[$h] = imap_base64($piece[$h]);
						}
						//$nom_fichier = str_replace(".doc","",$nom_fichier);
						//Ouverture du fichier et création s'il n'existe pas
						if (file_exists ($nom_fichier))
						{
						$newfichier = fopen($nom_fichier.$h,"w+");
						//Fermeture du fichier
						fclose($newfichier);
						}
 
			?>
			<!-- Affichage des données sur le mail -->
						<form name="mails" action="" method="post">
							<input type="hidden" name="origine" value="">
							<center><table border="1">
								<tr>
									<td width="30px"><?php echo $j; ?></td>
									<td width="250px"><?php echo $from; ?></td>
									<td width="280px"><?php echo $date; ?></td>
									<td width="275px"><p><a href="lire_mail.php?mid=<?php echo $j;?>"><?php echo $sujet; ?><a></p></td>
									<td width="200px">
										<?php
											if ($nom_fichier == TRUE)
											{
										?>
												<a href="lecture_pj.php?mid=<?php echo $j;?>"><?php echo "Télécharger la pièce jointe ($nom_fichier)";?></a>
										<?php	
											}
											else
											{
												echo NON;
											}
										?>
									</td>
									<td width="110px">
										<center><table>
											<tr>
												<td>NON</td>
												<td><input type="radio" name="suppression" style="vertical-align:top" value="1" checked="checked" /></td>
											</tr>
											<tr>
												<td>OUI</td>
												<td><input type="radio" name="suppression" style="vertical-align:top" value="1" /></td>
											</tr>
										</table></center>
									</td>
								</tr>
							</table></center>
						</form>
			<?php
					}
 
				}
			?>
				<!-- Tableau qui regroupe les différents éléments qui constitu le mail -->
				<center><table>
					<tr>
						<th width="30px"></th>
						<th width="250px"></th>
						<th width="280px"></th>
						<th width="275px"></th>
						<th width="200px"></th>
						<th width="110px"><input type="submit" value="Supprimer" class="" style="" /></th>
					</tr>
				</table><center>
		<?php
 
			}
 
			lecture_mail($boite,$serveur_entrant,$port,$protocole,$identifiant,$mot_de_passe);
		?>
 
	</body>
</html>