[ACCEPTED]-Best way to access Exchange using PHP?-mapi

Accepted answer
Score: 24

Update as of 2020:
Over a decade since this question and things 32 have moved on. Microsft now has a Rest API that 31 will allow you to easily access this data.

Original Answer

I 30 have not used PHP to do this but have experience 29 in using C# to achieve the same thing.

The 28 Outlook API is a way of automating Outlook 27 rather than connecting to Exchange directly. I 26 have previously taken this approach in a 25 C# application and it does work although 24 can be buggy.

If you wish to connect directly 23 to the Exchange server you will need to 22 research extended MAPI.

In the past I used 21 this wrapper MAPIEx: Extended MAPI Wrapper.

It is a C# project but I believe 20 you can use some .NET code on a PHP5 Windows 19 server. Alternatively it has a C++ core 18 DLL that you may be a able to use. I have 17 found it to be very good and there are some 16 good example applications.

Sorry for the 15 delay no current way to keep track of posts 14 yet.

I do agree adding more layer on to your 13 application and relying on 3rd party code 12 can be scary (and rightfully so.)

Today I 11 read another interesting post tagged up as MAPI that is 10 on a different subject. The key thing here 9 though is that it has linked to this important MS article. I have 8 been unaware of the issues until now on 7 using managed code to interface to MAPI 6 although the C++ code in the component should 5 be unaffected by this error as it is unmanaged.

This 4 blog entry also suggests other ways to connect 3 to MAPI/Exchange server. In this case due 2 to these new facts http://us3.php.net/imap may be the answer as 1 suggested by the other user.

Score: 14

Is your customer using Exchange 2007? If 11 so, I'd have a look at Exchange Web Services. If not, as hairy 10 as it can be, I think WebDAV is your best 9 bet.

Personally I don't like using the 8 Outlook.Application COM object route, as 7 its security prompts ("An application 6 is attempting to access your contacts. Allow 5 this?", etc.) can cause problems on 4 a server. I also think it would be difficult 3 to accomplish your impersonation-like tasks 2 using Outlook, such as sending mail as a 1 given user.

Score: 12

I have released an open-source MIT licensed 5 library that allows you to do some basic 4 operations in PHP using Exchange Web Services.

Exchange Web Services for PHP

I 3 have only tested it on Linux but I don't 2 see any reason why it wouldn't work on a 1 Windows installation of PHP as well.

Score: 10

I can't recommend Dmitry Streblechenko's 7 Redemption Data Objects library highly enough. It's a COM component 6 that provides a sane API to Extended MAPI 5 and is a joy to use. The Exchange API goalposts 4 move from one release to the next: “Use 3 the M: drive! No, use WebDAV! No, use ExOLEDB!… No, use 2 Web Services!” with the only constant being 1 good old MAPI.

Score: 7

I'm not a PHP dev but Google says that PHP 4 5+ can instantiate COM components. If you 3 can install Outlook on a box you could write 2 a PHP web service around the COM component 1 to handle the requests you need.

$outlook = COM("Outlook.Application")

Outlook API referance

Score: 7

I would recommend using "PHP Exchange Web Services" or short php-ews.

Fair amount 2 of documentation under the wiki, helped me a 1 lot.

Score: 6

This Zarafa PHP MAPI extension looks like it could work.


Score: 5

I would look into IMAP



Score: 5


It was last updated 3 months ago so it is 1 maintained

More Related questions