Send-MailMessage
CautionSend mail (obsolete)
Send-MailMessage -To a@x -From b@x -Subject s -SmtpServer smtp
Sends mail over SMTP. Microsoft marks it obsolete because it cannot guarantee secure connections. Avoid it in new scripts; on Microsoft 365 move to Send-MgUserMail (Microsoft Graph).
Examples
Send-MailMessage -To [email protected] -From [email protected] -Subject 'Backup OK' -SmtpServer mail.corp.localNotify on job completion
Syntax
Send-MailMessage -To .. -From .. -Subject .. [-Body ..] [-SmtpServer ..] ※非推奨化に注意
Before you run it
Mind credentials and plaintext SMTP.
Related commands
- ConvertTo-HtmlHTML reports
- Get-MessageTraceTrace mail flow (legacy)
The same reference, with no signal at all
Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store