PHP Class for COM Interface

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
TConsulting
New user
New user
Posts: 3
Joined: 2011-12-05 18:52

PHP Class for COM Interface

Post by TConsulting » 2011-12-05 19:36

I have enjoyed using hMailServer so much and with its return to Open Source I feel I should make some type of contribution to the project. I am currently working on creating a PHP Class to provide easier access to the the COM API for integration into our in-house control panel. I was curious if there was a general interest in such a Class and if so, are there any special features that people feel in general would be beneficial?

I am at the point now where I am trying to decide to branch my current code base to highly customize it for my application and maintain a more generic class or just maintain my customized version.

My code is not ready to publish, but to give an idea of the design approach:

I want to make most things available by only having to make 3 calls to the class

1. Instantiate the class eg. $a = new hmail();
2. Authenticate and connect eg. $a->Authenticate(<Username>,<Password>);
3. Request or Set options eg. $a->GetorSetOptions();

Instead of iteratively having to query the com objects the class provides an interface to retrieve collections and sub collections based upon parent object names.

So if you wanted all of an email addresse/user details you would make one request (eg. $a->GetUserDetails("example@example.com");) and it would return a multidimensional array with all of the details minus email messages.

Same idea with setting or changing a setting in hMailServer.

Any feedback on the desirability would be helpful to guage how much time I should put into making this generally consumable.

Thanks!

cncJasonB
New user
New user
Posts: 7
Joined: 2011-12-05 21:41

Re: PHP Class for COM Interface

Post by cncJasonB » 2011-12-05 21:47

I would be interested in this project. In our environment, hMailServer runs on a lonely windows box surrounded by LAMP and I need to be able to tighten our integration with our other web applications, which would all need to be able to pull message lists, messages, attachments, account info, pretty much everything at some point or other. Our staff works much more effectively in PHP than in VB or even JS.

User avatar
dzekas
Senior user
Senior user
Posts: 2486
Joined: 2005-10-13 21:28
Location: Lithuania

Re: PHP Class for COM Interface

Post by dzekas » 2011-12-05 22:23

cncJasonB wrote:I would be interested in this project. In our environment, hMailServer runs on a lonely windows box surrounded by LAMP and I need to be able to tighten our integration with our other web applications, which would all need to be able to pull message lists, messages, attachments, account info, pretty much everything at some point or other. Our staff works much more effectively in PHP than in VB or even JS.
Original poster said COM API. It won't integrate with LAMP. message lists, messages, attachments - see IMAP support in PHP. People are working with IMAP even without PHP IMAP support. Account info - your LAMPs can read it from MySQL database, if you give them read only access and setup hMailServer to store data in MySQL instead of MSSQL Compact

IMHO existing COM API works similar to classes in PHP and only error handling is clunky.

cncJasonB
New user
New user
Posts: 7
Joined: 2011-12-05 21:41

Re: PHP Class for COM Interface

Post by cncJasonB » 2011-12-05 22:45

My understanding of this may be flawed, but our idea was to build out a set of php services using this class that can be called from our LAMP applications on other boxes. Then we can connect, authenticate, and grab the pieces of data that we need. Would this not work?

TConsulting
New user
New user
Posts: 3
Joined: 2011-12-05 18:52

Re: PHP Class for COM Interface

Post by TConsulting » 2011-12-06 03:48

cncJasonB,
The PHP Class itself will not provide remote management functionality. I have been working for quite sometime to transition all of our management applications (Most of them web based) to SOAP based interfaces which is relatively easy to implement and maintain.

For more information you check out these links:

http://en.wikipedia.org/wiki/SOAP

http://php.net/manual/en/book.soap.php

cncJasonB
New user
New user
Posts: 7
Joined: 2011-12-05 21:41

Re: PHP Class for COM Interface

Post by cncJasonB » 2011-12-08 17:38

Thanks TConsulting,

It wasn't the services part that was hanging us up as much as just hooking into the hMailServer, but a user contributed script illuminated that (http://www.hmailserver.com/forum/viewto ... =14&t=2960). We use REST services instead of SOAP because they have a lot less overhead and are generally easier to work with.

I would still be interested in seeing a PHP class submitted that implements the COM interface for management.

Post Reply