This is a simple powershell function that sends email.  There are a series of variables (i.e. $subject) that can be placed in as a parameter instead.

To use this, you should make sure that your relay server is open to the host you are running this on. Please use the questions/answer sections for any questions that you may have.

I have used this to send out automatic emails for schedules tasks that have failed etc.



Function Mailer ($emailTo<# This is a simple function that that sends a message. 
The variables defined below can be passed as parameters by taking them out  
and putting then in the parentheseis above. 
i.e. "Function Mailer ($subject)" 
   $message = @" 
Some stuff that is meaningful  
Thank you, 
IT Department 
Cotendo Corporation 
$emailFrom = "noreply@<yourdomain>.com" 
$subject="<Your Text Here>" 
$smtpserver="<your mailhost>.<yourdomain>.com" 
$smtp=new-object Net.Mail.SmtpClient($smtpServer$smtp.Send($emailFrom$emailTo$subject$message)