I'm trying to send a Mail via the installed Outlook 2010 Client from my PHP application So far I've tried this suggestion, the top rated answer didn't work for me. Then I added
[COM_DOT_NET]
extension=php_com_dotnet.dll
at the end of php.ini
(C:/xampp/php).
I also checked my registry for EnableDCOM
, it is set to 'Y'
.
This is the code I'm using:
<?php
if (!defined("olMailItem")) {define("olMailItem",0);}
$oApp = new COM("Outlook.Application") or die('error');
$oMsg = $oApp->CreateItem(olMailItem);
$oMsg->Recipients->Add("xxx@xxx.org");
$oMsg->Subject=$subject;
$oMsg->Body=$message;
$oMsg->Save();
$oMsg->Send();
?>
The full error msg:
Warning: Uncaught exception 'com_exception' with message 'Failed to create COM object `Outlook.Application': Aufruf wurde durch Aufgerufenen abgelehnt. ' in C:\projekt_dreiskaen\mailtest.php:3 Stack trace: #0 C:\projekt_dreiskaen\mailtest.php(3): com->com('Outlook.Applica...') #1 {main} thrown in C:\projekt_dreiskaen\mailtest.php on line 3
Fatal error: Maximum execution time of 30 seconds exceeded in...
I'm on Win 7 Enterprise in a large corporate Windows Domain, using my local admin rights to run xampp. About 15 users will need to send e-mails from my application.
Any help would be appreciated :)