Share via


PowerShell: Send Email

This can be achieved with a simple command:

Send-MailMessage -To "receivers email address " -From "senders email address " -Subject "subject of email "  -SmtpServer  "your smtp server details "   -body "actual body of the email "

If we need to pass credentials for the SMTP server, this can be achieved as follows:

$mycredential = Get-Credential

 

Send-MailMessage -To "receivers email address " -From "senders email address " -Subject "subject of email "  -SmtpServer  "your smtp server details "    -Credential $mycredential   -body "actual body of the email "