Open new email dialog using powershell RRS feed

  • Question

  • Hello,

    I'm trying to write a powershell script for opening the new email windows of outlook.

    Anyone can help ?

    Thursday, February 9, 2017 7:13 AM

All replies

  • Just create a new mail message and open it.

    $message = $folder.Items.Add(0)


    Thursday, February 9, 2017 7:47 AM
  • You can create a new email with the following code, some settings are optional. 

    $ol = New-Object -comObject Outlook.Application
    #Create the new email
    $mail = $ol.CreateItem(0)
    #Optional, set the subject
    $mail.Subject = "<subject>"
    #Optional, set the body
    $mail.Body = "<body>"
    #Get the new email object
    $inspector = $mail.GetInspector
    #Bring the message window to the front

    Thursday, February 9, 2017 9:28 AM
  • Just for information sake.  "$message.Display()" does the same thing as getting an inspector and activating it.  In all cases the mail item editor is only brought to the front of Outlook but does not make Outlook the active application.

    I generally choose the folder and use it to create the item as it is more explicit and can be used to determine where the item is saved if it is not sent.

    I guess the choice depends on what else one is planning on doing with the item.


    Thursday, February 9, 2017 9:39 AM