Author |
|
apaame Newbie
Joined: 28 July 2016
Online Status: Offline Posts: 1
|
Posted: 28 July 2016 at 12:03pm | IP Logged
|
|
|
Hi
Please advise how can I fetch the actual attachments for any message. I'm doing the following - I'm getting the attachment object, it's mime index, filename, size, etc but but the actual data. What method do I need to call to fetch the attachment data?
$oFrom = /* @var $oFrom \MailSo\Mime\EmailCollection */ $oMessage->getFrom();
echo "\t".htmlentities($oMessage->getUid().') '.$oMessage->getSubject().($oFrom ? ' ('.$oFrom->ToString().')' : ''))."\n";
$UID = $oMessage->getUid();
$iMessage = $oApiMailManager->getMessage($oAccount, $sFolder, (int) $UID, '', true, true, 600000);
$oAttachments = $iMessage->getAttachments();
if(is_object($oAttac hments)) {
&n bsp; echo "Attachments:\r\n";
&n bsp; $oAttachments->ForeachList(function ( $iAttachment) {
&n bsp; global $oApiMailManager;
&n bsp; global $oAccount;
&n bsp; global $sFolder;
&n bsp; global $UID;
&n bsp; echo "\t".$iAttachment->getCid()."\t";
&n bsp; echo $iAttachment->isInline()?"INLINE\r\n":"FILE".$iAttachment->getFileName()."\r\n";
&n bsp; $idx = $iAttachment->getMimeIndex();
&n bsp; });
Thanks!
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 28 July 2016 at 4:58pm | IP Logged
|
|
|
Currently it isn't possible to access attachments via PHP API, but it can be done via Web API. Please see:
Web API / Receiving mail / MessageGet
Once you get information about the message, it will contain Attachments item with hashes provided for each of the attachments, that's all you need to get attachments content. The documentation page shows how to build a link for retrieving a particular attachment item.
--
Regards,
Igor, AfterLogic Support
|
Back to Top |
|
|
MAlly Newbie
Joined: 16 March 2017 Location: United States
Online Status: Offline Posts: 11
|
Posted: 13 February 2018 at 9:39am | IP Logged
|
|
|
Is it possible to use download link with AuthToken from provided example to create download link and and then use it to download attachment via cURL?
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6104
|
Posted: 13 February 2018 at 8:34pm | IP Logged
|
|
|
Yes sure, that should work with cURL just fine. You can find an example of uploading files with cURL here.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|