Thursday, August 31, 2017

Test Send Mail Power Shell Script

Write-Host "Sending Email"
$smtpServer = "192.168.1.246"
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = "test1@abc.co.in"
$msg.ReplyTo = "test1@abc.co.in"
$msg.To.Add("jatin@xyz.com")
$msg.subject = "My Subject"
$msg.body = "This is the email Body."
$smtp.Send($msg)

No comments: