title: Send outlook email from powershell script
body: <p>When I write the following script into the powershell command line one by one, it successfully sends the email, but when I run the script, it returns a bunch of errors. I'm guessing something syntactically needs to be changed in order to run it as a script? Any ideas?</p>
  
  <pre><code>Start-Process Outlook
  
  $o = New-Object -com Outlook.Application
  
  
  $mail = $o.CreateItem(0)
  
  #2 = high importance email header
  $mail.importance = 2
  
  $mail.subject = “Auto Build Test“
  
  $mail.body = “This is a test“
  
  #for multiple email, use semi-colon ; to separate
  $mail.To = “myemail@company.com"
  $mail.Send()
  
  # $o.Quit()
  </code></pre>