[imp] How to download attachment from Mime_Part?

Kristers Zariņš sharrpenized at gmail.com
Thu May 7 14:31:35 UTC 2015


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();
$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.


More information about the imp mailing list