Submitted By: Kent Finkle

Sends an email using Microsoft Outlook.

PowerShell
Edit|Remove
$comments = @'
Script name: Send-Mail.ps1
Created on: Friday, July 20, 2007
Author: Kent Finkle
Purpose: How can I use Windows Powershell to
Send Mail with Outlook ?
'@
 
$olMailItem = 0 
 
$olApp = new-object -comobject outlook.application 
 
$NewMail = $olApp.CreateItem($olMailItem) 
 
$NewMail.Subject = "the legendary Peter Costantini" 
 
$NewMail.To = Peter_Constantini@microsoft.com 
 
$NewMail.Body = "never met a script he couldn’t enhance " `
+ "by having it read computer names from a text file" 
 
$NewMail.Send()