Quoting Kristers Zariņš <sharrpeni...@gmail.com>:

I cannot figure out how to download attachments on my server. Below is the
code I'm using. getContents() soundes like the method I need, but it doesnt
return anything:

$Mime_Part = $Data_Fetch->getStructure();

getStructure() returns the MIME structure of the message (BODYSTRUCTURE FETCH part).

You need to fetch the actual body contents of any given MIME part to see the data. (e.g. getBodyPart() and/or getBodyPartDecode()).

$Mime_Parts = $Mime_Part->partIterator();

foreach ($Mime_Parts as $p) {
    if ( $this->isAttachment( $p ) ) {// This actually works. Copied from
IMP source

        // How do I download attachments and save them on my server here?

        $attachment_1 = $p->getContents(); // Always empty string
        $attachment_1 = $p->getContents(['stream' => true]); // Always NULL
        //What now?
    }
}

How can I actually download? Thanks.

michael

___________________________________
Michael Slusarz [slus...@horde.org]

--
imp mailing list
Frequently Asked Questions: http://wiki.horde.org/FAQ
To unsubscribe, mail: imp-unsubscr...@lists.horde.org

Reply via email to