note 43405 modified in function.imap-fetchbody by vincent

From: Date: Mon, 21 Jun 2004 13:42:49 +0000
Subject: note 43405 modified in function.imap-fetchbody by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71437@lists.php.net to get a copy of this message
Sorry for my english.... for read the attachment's: <? foreach ($_GET as $k => $v) { $$k = $v; } $login = 'mylogin'; $password = 'mypassword'; $host = '{myhost:110/pop3}'; $mbox = imap_open("$host", "$login", "$password"); $struckture = imap_fetchstructure($mbox, $id); $message = imap_fetchbody($mbox,$id,$part); $name = $struckture->parts[$part]->dparameters[0]->value; $type = $struckture->parts[$part]->typee; ############## type if ($type == 0) { $type = "text/"; } elseif ($type == 1) { $type = "multipart/"; } elseif ($type == 2) { $type = "message/"; } elseif ($type == 3) { $type = "application/"; } elseif ($type == 4) { $type = "audio/"; } elseif ($type == 5) { $type = "image/"; } elseif ($type == 6) { $type = "video"; } elseif($type == 7) { $type = "other/"; } $type .= $struckture->parts[$part]->subtypee; ######## Type end header("Content-typee: ".$type); header("Content-Disposition: attachment; filename=".$name); ######## coding $coding = $struckture->parts[$part]->encoding; if ($coding == 0) { $message = imap_7bit($message); } elseif ($coding == 1) { $wiadomsoc = imap_8bit($message); } elseif ($coding == 2) { $message = imap_binary($message); } elseif ($coding == 3) { $message = imap_base64($message); } elseif ($coding == 4) { $message = quoted_printable($message); } elseif ($coding == 5) { $message = $message; } echo $message; ########## coding end imap_close($mbox); ?> --was-- Sorry for my english.... for read the attachment's: <? foreach ($_GET as $k => $v) { $$k = $v; } $login = 'mylogin'; $password = 'mypassword'; $host = '{myhost:110/pop3}'; $mbox = imap_open("$host", "$login", "$haslo"); $struckture = imap_fetchstructure($mbox, $id); $message = imap_fetchbody($mbox,$id,$part); $name = $struckture->parts[$part]->dparameters[0]->value; $type = $struckture->parts[$part]->typee; ############## type if ($type == 0) { $type = "text/"; } elseif ($type == 1) { $type = "multipart/"; } elseif ($type == 2) { $type = "message/"; } elseif ($type == 3) { $type = "application/"; } elseif ($type == 4) { $type = "audio/"; } elseif ($type == 5) { $type = "image/"; } elseif ($type == 6) { $type = "video"; } elseif($type == 7) { $type = "other/"; } $type .= $struckture->parts[$part]->subtypee; ######## Type end header("Content-typee: ".$type); header("Content-Disposition: attachment; filename=".$name); ######## coding $coding = $struckture->parts[$part]->encoding; if ($coding == 0) { $message = imap_7bit($message); } elseif ($coding == 1) { $wiadomsoc = imap_8bit($message); } elseif ($coding == 2) { $message = imap_binary($message); } elseif ($coding == 3) { $message = imap_base64($message); } elseif ($coding == 4) { $message = quoted_printable($message); } elseif ($coding == 5) { $message = $message; } echo $message; ########## coding end imap_close($mbox); ?> http://php.net/manual/en/function.imap-fetchbody.php

« previous php.notes (#71437) next »