Sending defer message delivery and change default account using Powershell

前端 未结 2 640
执念已碎
执念已碎 2021-01-07 10:57

I use Outlook 2010 and Powershell 2.0.

I want send a Outlook message, and delay delivery programmatically of a message using Powershell.

How can I create a n

2条回答
  •  抹茶落季
    2021-01-07 11:47

    If you try this:

    $ol = New-Object -comObject Outlook.Application  
    $mail = $ol.CreateItem(0)  
    $mail | Get-Member
    

    you'll get a list of all methods/properties available on the mail object.

    One property is DeferredDeliveryTime. You can set it like this:

    #Stay in the outbox until this date and time
    $mail.DeferredDeliveryTime = "11/2/2013 10:50:00 AM"
    

    Or:

    #Wait 10 minutes before sending mail
    $date = Get-Date
    $date = $date.AddMinutes(10)
    $mail.DeferredDeliveryTime = $date
    

提交回复
热议问题