![](/img/trans.png)
[英]Send e-mail from outlook using PHP,, CC and BCC problem -Not about PHPMailer
[英]Send e-mail from outlook using PHP,, Attachment problem
我正在尝试通过 php 通过 Outlook 发送电子邮件。 我用这段代码成功了,但我找不到如何添加附件。
$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();
我发现。 这是使用完整路径。
$oMsg->Attachments->Add("C:\xampp\htdocs\outlook\file.txt");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.