PowerShell can access com object of the outlook application to initiate a mail. Based on the email account configured, PowerShell can trigger a new mail.

Send email from Outlook application using PowerShell

An account must be configured in outlook for the script to work.

$outlook = new-object -comobject outlook.application

$email = $outlook.CreateItem(0)
$email.To = "[email protected]"
$email.Subject = "New email test"
$email.Body = "This is a testing email" 
$email.Attachments.add("D:\Files\project-report.pptx")

$email.Send()
$outlook.Quit()

Executing above code will send a mail from the configured account to the To address mentioned in the script.

Multiple destination email addresses and HTML email body can also be added.

Like initiating new emails, PowerShell can also read and reply to incoming emails in outlook. I have explained the same with a use case in a different post. Click here to view the article.

Hope you liked this article and thank you for reading.