PowerShell is proving to be a wonderful tool for Microsoft System Admins. The ability to send emails in a PowerShell script can be quite useful, you can use this simple little function to send an email from PowerShell.
You could potentially use this function to send you an email when an automatic PowerShell task runs and fails or if you want to notify yourself of something during the script.
The results of my test are below the PowerShell code.
#Set your outgoing SMTP Server, this will work as long as your server does not need authentication
$MailServer = "mail.bigpond.com" #Change this to our SMTP server
#Creating a Mail object
$MailObject = new-object Net.Mail.MailMessage
#Creating SMTP server object
$SMTP = new-object Net.Mail.SMTPClient($MailServer)
#Actual email text
$MailObject.From = "[email protected]"
$MailObject.ReplyTo = "[email protected]"
$MailObject.subject = "This is the test email"
$MailObject.body = "Hello," + "`r`n" + `
"Powershell is sending you an email"
#Send the email