display imap attached files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux