[imp] How to download attachment from Mime_Part?
    Michael M Slusarz 
    slusarz at horde.org
       
    Thu May  7 14:38:00 UTC 2015
    
    
  
Quoting Kristers Zariņš <sharrpenized at 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 [slusarz at horde.org]
    
    
More information about the imp
mailing list