Friday, February 28, 2014

How to Send Mail using Power Shell Script

$EmailFrom = "noreply@yourdomain.com"
$EmailTo = "abc@
yourdomain.com"
$Subject = "Notification from ABC Company from Public IP now 10.46 AM"
$Body = "this is a notification from ABC Company.."
$SMTPServer = "X.X.X.X"
$SMTPClient = New-Object Net.Mail.SmtpClient($SMTPServer, 25)
$SMTPClient.EnableSsl = $false
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("username", "password")
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)


Author: Sukanta Kumar Biti

Script Verified. For more info Contact:sukantakumarbiti05@gmail.com