Share via


Using Powershell to send email message using CDOSYS

Scripts are used do a pre-check before getting started with debugging application.
VB Scripts being the favourite on Microsoft platform.

Most common being CDOSYS issues.

Below is the Powershell script to send email using System.Net.Mail namespace.

[System.Net.Mail.MailMessage]$message = New-Object System.Net.Mail.MailMessage("from@contoso.com", "to@contoso.com", "This is Subject", "This is body")
[System.Net.Mail.SmtpClient]$client = New-Object System.Net.Mail.SmtpClient("XXX.XXX.XXX.XXX")
$client.Timeout = 100
$client.Send($message)

Long live Powershell!