[英]Send e-mail from outlook using PHP,, Attachment problem
i am trying to send e mail via outlook by php.我正在尝试通过 php 通过 Outlook 发送电子邮件。 i succeed this with this code, but i couldnt find how to add an attachmnet.
我用这段代码成功了,但我找不到如何添加附件。
$subject="Hi from your city";
$message= "hello my darling";
$to="example@gmail.com";
// starting outlook
com_load_typelib("outlook.application");
if (!defined("olMailItem")) {define("olMailItem",0);}
$outlook_Obj = new COM("outlook.application") or die("Unable to start Outlook");
//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();
i found.我发现。 this is working with full path.
这是使用完整路径。
$oMsg->Attachments->Add("C:\xampp\htdocs\outlook\file.txt"); $oMsg->Attachments->Add("C:\xampp\htdocs\outlook\file.txt");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.