note 43405 added to function.imap-fetchbody
| From: | noose at rn2 dot php dot net | Date: | Sun, 20 Jun 2004 08:04:14 +0000 |
| Subject: | note 43405 added to function.imap-fetchbody | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71396@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", "$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);
?>
----
Manual Page -- http://www.php.net/manual/en/function.imap-fetchbody.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43405
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43405&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43405&report=yes
Search -- http://master.php.net/manage/user-notes.php