Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks
Bibliothèques et frameworks Forum d'entraide sur les frameworks, templates, bibliothèques de code (PDFLib, eZPdf, JpGraph, Artichow, PEAR, etc). Avant de poster : FAQ bibliothèques, toutes les FAQ PHP et cours bibliothèques
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 07/06/2008, 23h27   #1
Invité régulier
 
Inscription : avril 2008
Messages : 48
Détails du profil
Informations personnelles :
Âge : 25

Informations forums :
Inscription : avril 2008
Messages : 48
Points : 6
Points : 6
Par défaut [IMAP] Comment extraire un message reçu d'un email ?

salut.voila le code de ma page :
Code :
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
//Tout d'abord, on ouvre une boite mail
$mail = imap_open("{localhost:110/pop3}INBOX",'utilisateur','motdepasse');
 
$nbmess = imap_num_msg($mail);
if ($nbmess == 0)
{
print "
	<div align='center'>
	  <b>Aucun message présent sur le serveur</b>
          <br /><br />
	</div>
      ";
} 
else
{   
for($j=1;$j<=$nbmess;$j++)
{
titre au préalable
$header = imap_headerinfo($mail,$j);
$sujet = $header->subject;
//Extraction de la structure du message	
$struct = imap_fetchstructure($mail,$j);
if ($struct->type == 1)
{
$nbrparts = !$struct->parts ? "1" : count($struct->parts);
}
$piece = array();
for($h=2;$h<=$nbrparts;$h++)
{
$part = $struct->parts[1] ;
//Extraction du code binaire de la pièce jointe
$piece = imap_fetchbody($mail,$j,$h);
 
 
if ($part->encoding == "3") 
{
//Comptage du nombre de parametres
$nbparam =  count($part->parameters);
 
for($i=0;$i<$nbparam;$i++)
{
 
$param = $part->parameters[$i];
if ($param->attribute == "NAME")
{
$nom_fichier = $param->value;
}
else
{
$nom_fichier = "Nom de fichier introuvable";
}
}
 
$piece[$h] = imap_base64($piece[$h]);
}
$nom_fichier = str_replace(".doc","",$nom_fichier) ;
//Ouverture du fichier et création s'il n'existe pas
$newfichier = fopen("C:/".$nom_fichier.$h.".doc","w+");
//Ecriture dans le fichier
fwrite($newfichier,$piece[$h]);
//Fermeture du fichier
fclose($newfichier);
}
}
}
?>
mais il me fait cette erreur:
Fatal error: Call to undefined function imap_open() in C:\wamp\www\recumessg.php on line 9.
svp j'ai besoin à votre aide.
merci d'avance
haphp est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/06/2008, 14h06   #2
Membre Expert
 
Inscription : janvier 2007
Messages : 1 452
Détails du profil
Informations personnelles :
Âge : 27
Localisation : France, Paris (Île de France)

Informations forums :
Inscription : janvier 2007
Messages : 1 452
Points : 1 914
Points : 1 914
salut,

Ben faudrait peut être activé le module imap dans la compilation de PHP.
Tout simplement.


a plus
kaymak est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/06/2008, 15h20   #3
Invité régulier
 
Inscription : avril 2008
Messages : 48
Détails du profil
Informations personnelles :
Âge : 25

Informations forums :
Inscription : avril 2008
Messages : 48
Points : 6
Points : 6
mais comment activé le module IMAP?je suis débutante au php ,ne connu pas beaucoup de chose.
haphp est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 02h08.


 
 
 
 
Partenaires

Hébergement Web