PowerShell: Send Email


I scheduled a task to send me the every day report by Email. Here is how I did by using PowerShell:

$emailFrom = Monitor@test.com
$emailTo = jackie.chen@test.com

$subject = “Everyday Report”
$body = Get-Content C:\Logs\EverydayReport.txt

$smtpServer = “SMTP.test.com”
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)

2 thoughts on “PowerShell: Send Email

Leave a reply to Boe Prox Cancel reply