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
| <?php
$boiteMail = 'mail.planet-work.com';
$port = 110;
$login = 'irm@gakkk-position.fr';
$motDePasse = 'bari';
$mbox = imap_open('{'.$boiteMail.':'.$port.'/pop3}', $login, $motDePasse);
if (FALSE === $mbox) {
die('La connexion a échoué. Vérifiez vos paramètres!');
} else {
$uid = $_GET['uid'];
$headerText = imap_fetchHeader($mbox, $uid, FT_UID);
$header = imap_rfc822_parse_headers($headerText);
// REM: Attention s'il y a plusieurs sections
$corps = imap_fetchbody($mbox, $uid,1, FT_UID);
}
imap_close($mbox);
?>
<html>
<head><title>Exemple IMAP</title></head>
<body>
<?php
$from=$header->from;
//echo "Message de:".$from[0]->personal." [".$from[0]->mailbox."@".$from[0]->host."]<br>";
echo $corps;
$fp = fopen("fichier.txt","w");
fwrite($fp,$corps);
fclose($fp);
?>
</body>
</html> |
Partager