display imap attached files?
| From: | Fredrik Hampus | Date: | Sat, 22 Jan 2005 00:45:25 +0000 |
| Subject: | display imap attached files? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-206944@lists.php.net to get a copy of this message | ||
Hi!
Iam trying too make a page where the function is to display an attached .jpg file
from a imap mailbox. This is a small code i found and rewrote some...
<?php
include '/etc/labbuser';
$mbox = imap_open ("{localhost:993/imap/ssl/novalidate-cert}INBOX", "$imuser", "$impass");
$mno = "57";
$parttypes = array ("text", "multipart", "message", "application", "audio", "image", "video", "other");
function buildparts ($struct, $mno = "") {
global $parttypes;
switch ($struct->type):
case 1:
$r = array ();
$i = 1;
foreach ($struct->parts as $part)
$r[] = buildparts ($part, $mno.".".$i++);
return implode (", ", $r);
case 2:
return "{".buildparts ($struct->parts[0], $mno)."}";
default:
echo "--Size--";
echo $struct->bytes;
echo " ";
echo $struct->subtype;
echo "<br>";
if ($struct->subtype == "JPEG") {
echo "MATCH";
echo "<br>";
}
return '<a href="?p='.substr ($mno, 1).'">'.$parttypes[$struct->type]."/".strtolower ($struct->subtype)."</a>";endswitch; } $struct = imap_fetchstructure ($mbox, $mno); echo buildparts ($struct); imap_close($mbox); ?> This will display how many parts there is in the mail and the size of each one of them and what type they are. but how do a display the image of an attached jpg file on a webpage? //Fredrik