Sending Email
suggest changeIntroduction
Send-MailMessage sends mail through SMTP. It is available in Windows PowerShell 2.0 and later, and in PowerShell 6 and later. It does not implement modern OAuth sign-in.
Parameters
| Parameter | Details |
|---|---|
Attachments <String[]> |
Paths of files to attach. Paths can be piped to Send-MailMessage. |
Bcc <String[]> |
Addresses that receive a copy but do not appear as recipients. Enter an optional name and the required address, such as Name <someone@example.com> or someone@example.com. |
Body <String> |
Content of the message. |
BodyAsHtml |
Indicates that the content is HTML. |
Cc <String[]> |
Addresses that receive a copy and appear as Cc recipients. |
Credential |
Account allowed to send as From. The default is the current user. Enter a name such as User or Domain\User, or a PSCredential. |
DeliveryNotificationOption |
Delivery status notifications. More than one value is allowed. Notifications go to the sender, not the To address. Values: None, OnSuccess, OnFailure, Delay, Never. |
Encoding |
Encoding for the body and subject. Values: ASCII, UTF8, UTF7, UTF32, Unicode, BigEndianUnicode, Default, OEM. |
From |
Address the message is sent from. The address is required. A display name is optional. |
Port |
SMTP port. The default is 25. This parameter was added in Windows PowerShell 3.0. |
Priority |
Normal, High, or Low. |
SmtpServer |
SMTP server. The default is $PSEmailServer. |
Subject |
Subject of the message. |
To |
Addresses the message is sent to. The address is required. A display name is optional. |
UseSsl |
Connects to the SMTP server with SSL/TLS. |
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents