使用PHP发送Outlook 2010电子邮件 [英] Send Outlook 2010 email using PHP

查看:468
本文介绍了使用PHP发送Outlook 2010电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用默认的Windows 7 Outlook 2010邮件帐户发送电子邮件.

I'm looking to use the default Windows 7 Outlook 2010 mail account to send an email.

我尝试过:

oApp  = new COM("Outlook.Application") or die('error');
$oMsg  = $oApp ->CreateItem($oApp->OlItemType->olMailItem);
$oMsg ->Recipients->Add("xxx@xxx.com");
$oMsg ->Subject="aaaa";
$oMsg ->Body="body";
$oMsg ->Save();
$oMsg ->Send();

但是我得到了错误:

Outlook loaded, version 14.0.0.7109
Fatal error: Uncaught exception 'com_exception' with message 'Unable to lookup  
`OlItemType': Unknown name. ' in C:\xampp\htdocs\Intranet_IT_Request_Form
\comunread.php:5 Stack trace: #0 C:\xampp\htdocs\Intranet_IT_Request_Form
\comunread.php(5): unknown() #1 {main} thrown in C:\xampp\htdocs
\Intranet_IT_Request_Form\comunread.php on line 5

我的研究告诉我,我需要cdo.dll,其中包含所有电子邮件功能,但是我只能在Outlook 2007中安装它.根本不实用.

My research tells me I need cdo.dll, which contains all the email functions, but I can only install this with Outlook 2007; not practical at all.

有人知道如何使用PHP发送Outlook 2010电子邮件吗? (我正在使用XAMPP).

Does anyone know how to send an Outlook 2010 email using PHP? (I'm using XAMPP).

非常感谢

推荐答案

这有效:

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();

这篇关于使用PHP发送Outlook 2010电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆