Thursday, December 23, 2010

How To: Sending email over Power Shell

$EmailFrom = "your@email.com"
$EmailTo = "destination@email.com"
$Subject = "Your subject goes here"
$Body = "the body info which usually will a parameter with gathered info."
$SMTPServer = "smtp.email.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("user", "pwd");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)

No comments:

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge