Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Lite 7

 AfterLogic Forum : AfterLogic WebMail Lite 7
Subject Topic: error retrieving messages through API Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
leevee
Newbie
Newbie
Avatar

Joined: 22 February 2017
Location: South Africa
Online Status: Offline
Posts: 3
Posted: 22 February 2017 at 1:46am | IP Logged Quote leevee

Hi
I am using your API to retrieve messages.
I have used your example in "Getting New or Last Messages" exactly, but i get the error;
Fatal error: Call to undefined method CApiMailMessage::From()

I can number of unread messages and folders etc perfectly fine, it's only when trying your above example.
It bombs out looking for this method;
$oFrom = $oMessage->From();
as well as;
$oMessage->Uid(),$oMessage->Subject()
Back to Top View leevee's Profile Search for other posts by leevee
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6040
Posted: 22 February 2017 at 2:10am | IP Logged Quote Igor

From and Subject are properties, not methods. Hence, the values need to be retrieved as follows:

Code:
$oFrom = $oMessage->From;
$sSubject = $oMessage->Subject;


If you prefer using methods, you can use these:

Code:
$oFrom = $oMessage->GetFrom();
$sSubject = $oMessage->GetSubject();


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

Joined: 22 February 2017
Location: South Africa
Online Status: Offline
Posts: 3
Posted: 22 February 2017 at 3:39am | IP Logged Quote leevee

Thanks Igor!
The method way using the get in front worked a charm.
(For some reason the first way doesn't work.)
I can work with it like that


Another question: Is there any way to receive attachments with this API??
Back to Top View leevee's Profile Search for other posts by leevee
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6040
Posted: 22 February 2017 at 4:05am | IP Logged Quote Igor

Quote:
(For some reason the first way doesn't work.)


My mistake, sorry, those properties are protected and cannot be used from outside the class.

Quote:
Is there any way to receive attachments with this API?


No that's not currently supported by PHP API, you would need to use Web API for that:

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.

Hope this helps.

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

Joined: 22 February 2017
Location: South Africa
Online Status: Offline
Posts: 3
Posted: 22 February 2017 at 4:16am | IP Logged Quote leevee

great.
Thanks for your help!
Back to Top View leevee's Profile Search for other posts by leevee
 

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