I kindly ask you help in order to fix it. From windows 7 I am trying to send email using Outlook 2010 with Xampp control panel version 3.2.2.
Php.ini:
[COM_DOT_NET]
extension=php_com_dotnet.dll
I also checked my registry for EnableDCOM
, it is set to 'Y'
My php code is:
if (!defined("olMailItem")) {define("olMailItem",0);}
$outlook_Obj = new COM("outlook.application") or die("Outlook no start");
//just to check you are connected.
echo "Loaded MS Outlook, version {$outlook_Obj->Version}\n";
$oMsg = $outlook_Obj->CreateItem(olMailItem);
$oMsg->Recipients->Add($to);
$oMsg->Subject=$subject;
$oMsg->Body=$message;
$oMsg->Save();
$oMsg->Send();
?>
Error occur on line $oMsg->Recipients->Add($to);
is
Loaded MS Outlook, version 14.0.0.7172
Fatal error: Uncaught exception 'com_exception' with message 'Error [0x80004004] Operation failed. ' in C:\xampp\htdocs\index.php:25 Stack trace: #0 C:\xampp\htdocs\index.php(25): unknown() #1 {main} thrown in C:\xampp\htdocs\index.php on line 25
Please help me.
User contributions licensed under CC BY-SA 3.0