![](/img/trans.png)
[英]Automating Exchange Mail Box Export using Task Scheduler and Powershell
[英]Mail Automation Task using Powershell
我一直在嘗試使用 Powershell 通過我的 outlook 帳戶自動發送郵件和附件。
$OL = New-Object -ComObject outlook.application
Start-Sleep 5
<#
olAppointmentItem
olContactItem
olDistributionListItem
olJournalItem
olMailItem
olNoteItem
olPostItem
olTaskItem
#>
#Create Item
$mItem = $OL.CreateItem("olMailItem")
$mItem.To = "PlayingWithPowershell@gmail.com"
$mItem.Subject = "PowerMail"
$mItem.Body = "SENT FROM POWERSHELL"
$mItem.Send()
堅持在代碼中添加附件。 請幫幫我。
查看此處的文檔。
在你的情況下是這樣的:
$mItem.Attachments.Add( "C:\My Documents\Q496.xls", olByValue, 1, "4th Quarter 1996 Results Chart"
Arguments 是來源、類型、Position 和顯示名稱。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.