Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach ($parts[$i]->dparameters as $object) {
- if (strtolower($object->attribute) == 'filename') {
- $file = $object->value;
- $filename = pathinfo($file, PATHINFO_FILENAME);
- $ext = pathinfo($file, PATHINFO_EXTENSION);
- $dst = 'files'. '/' . $filename . "." . $ext;
- /* don't overwrite */
- if (!file_exists($dst)) {
- $fp = fopen($dst, 'w');
- $body = imap_fetchbody($mbox, imap_msgno($mbox, $id), $fpos);
- $data = $this->get_decode_value($body, $object->type);
- fputs($fp, $data);
- fclose($fp);
- }
- }
- object(stdClass)#276 (11) {
- ["type"] =>
- int(1)
- ["encoding"] =>
- int(0)
- ["ifsubtype"] =>
- int(1)
- ["subtype"] =>
- string(7) "RELATED"
- ["ifdescription"] =>
- int(0)
- ["ifid"] =>
- int(0)
- ["ifdisposition"] =>
- int(0)
- ["ifdparameters"] =>
- int(0)
- ["ifparameters"] =>
- int(1)
- ["parameters"] =>
- array(1) {
- [0] =>
- object(stdClass)#275 (2) {
- ["attribute"] =>
- string(8) "boundary"
- ["value"] =>
- string(36) "------------06304D14834AD529353E49FD"
- }
- }
- ["parts"] =>
- array(2) {
- [0] =>
- object(stdClass)#274 (12) {
- ["type"] =>
- int(0)
- ["encoding"] =>
- int(1)
- ["ifsubtype"] =>
- int(1)
- ["subtype"] =>
- string(4) "HTML"
- ["ifdescription"] =>
- int(0)
- ["ifid"] =>
- int(0)
- ["lines"] =>
- int(18)
- ["bytes"] =>
- int(487)
- ["ifdisposition"] =>
- int(0)
- ["ifdparameters"] =>
- int(0)
- ["ifparameters"] =>
- int(1)
- ["parameters"] =>
- array(1) {
- [0] =>
- object(stdClass)#273 (2) {
- ["attribute"] =>
- string(7) "charset"
- ["value"] =>
- string(5) "utf-8"
- }
- }
- }
- [1] =>
- object(stdClass)#272 (14) {
- ["type"] =>
- int(5)
- ["encoding"] =>
- int(3)
- ["ifsubtype"] =>
- int(1)
- ["subtype"] =>
- string(4) "JPEG"
- ["ifdescription"] =>
- int(0)
- ["ifid"] =>
- int(1)
- ["id"] =>
- string(37) ""
- ["bytes"] =>
- int(171440)
- ["ifdisposition"] =>
- int(1)
- ["disposition"] =>
- string(6) "inline"
- ["ifdparameters"] =>
- int(1)
- ["dparameters"] =>
- array(1) {
- [0] =>
- object(stdClass)#271 (2) {
- ["attribute"] =>
- string(8) "filename"
- ["value"] =>
- string(21) "revised8 10.43.39.jpg"
- }
- }
- ["ifparameters"] =>
- int(1)
- ["parameters"] =>
- array(1) {
- [0] =>
- object(stdClass)#270 (2) {
- ["attribute"] =>
- string(4) "name"
- ["value"] =>
- string(21) "revised8 10.43.39.jpg"
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment