Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Pro

 AfterLogic Forum : AfterLogic WebMail Pro
Subject Topic: Get Attachment From Message Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
bravedave
Newbie
Newbie


Joined: 05 September 2014
Location: Australia
Online Status: Offline
Posts: 35
Posted: 25 May 2016 at 8:03pm | IP Logged Quote bravedave

I want to be able to extract the binary data for an attachment - so I can save it - eg. pdf or image

using:

$oApiMailManager = CApi::Manager('mail');

if ( $oCollection = $oApiMailManager->getMessageList( $oAccount, $sFolder, $iOffset, $iLimit)) {

/* i have a collection of messages */
$collA = $oCollection->GetAsArray();
foreach ( $collA as $oMessage) {
     /* i can do stuff */
     $Uid = $oMessage->getUid();
     /* etc */

     $attachments = $oMessage->getAttachments()

     but - how to I get to the attachment to save the file

     foreach ( $attachments as $attachment) {
        file_put_contents( 'c:\filename.jpg', $attachment->binarydata)

     }

}

}


thanks in avance
Back to Top View bravedave's Profile Search for other posts by bravedave
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 26 May 2016 at 2:43am | IP Logged Quote Igor

PHP API doesn't support that directly, getAttachments() method only returns information about attachments, not the files themselves. You would need to use AJAX API for that, please see:

AJAX API - MessageGet

Hope this helps!

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
bravedave
Newbie
Newbie


Joined: 05 September 2014
Location: Australia
Online Status: Offline
Posts: 35
Posted: 26 May 2016 at 4:42am | IP Logged Quote bravedave

Thanks for the reply
not quite what I was hoping for there
Back to Top View bravedave's Profile Search for other posts by bravedave
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide