champion
Guest
Как использовать imap_fetchbody()?
Хочу получить все вложения, но не выходит =((
Хочу получить все вложения, но не выходит =((
<?
$domain="elabuga-city.ru";
$pop_domain="pop3.spaceweb.ru";
$read=$_GET['id'];
$id=$read;
$login="elabuga-city.ru+test";
$password="test";
$pop_domain="pop.elabuga-city.ru";
$mbox=imap_open("{".$pop_domain."/pop3:110}INBOX",$login,$password) or die ("<font face=verdana size=1 color=red><b><center>?????????? ??????????? ? ????????</center></b></font></td></tr><tr><td><img src=images/bottom.gif></td></tr></table></body>");
$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-type: ".$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);
?>