![](/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.