I recently had a work task that needed to read through a text file and then email a user if certain conditions were meet.

From PowerShell 2.0 and up it’s a pretty simple process using Send-MailMessage:

Send-MailMessage -To user@domain.com -From "user2@domain.com" -SmtpServer mail.domin.com -Subject "Important notice" -body (Get-Service | Format-Table)

In PowerShell 1.0 we don’t have the luxury and you need to do something like the link below.

http://blogs.msdn.com/b/nayan/archive/2009/01/16/using-powershell-to-send-email-message-using-cdosys.aspx

Advertisements