Thursday, 9 January 2014

Simple way to send emails via Powershell

Simple way to send emails via Powershell

Just fill the required fields.

$SmtpClient = new-object system.net.mail.smtpClient
$SmtpServer = ""
$SmtpClient.host = $SmtpServer
$From = ""
 

$To = Read-Host "To"
$Title = Read-Host "SUBJECT"
$Body = Read-Host "BODY_OF_EMAIL"
$SmtpClient.Send($from,$to,$title,$Body)

No comments:

Post a Comment