Best way to access Exchange using PHP?

◇◆丶佛笑我妖孽 提交于 2019-11-27 06:36:05
John

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

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

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

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

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

Update:

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

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

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

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

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

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

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

Exchange Web Services for PHP

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

Duncan Smart

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

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

$outlook = COM("Outlook.Application")

Outlook API referance

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

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

Scott Szretter

This Zarafa PHP MAPI extension looks like it could work.

I would look into IMAP

IMAP, POP3 and NNTP

https://github.com/Garethp/php-ews

It was last updated 3 months ago so it is maintained

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!