PowerShell Logo Small

Send-MailMessage



This is the built-in help made by Microsoft for the command 'Send-MailMessage', in PowerShell version 2 - as retrieved from Windows version 'Microsoft® Windows Vista™ Ultimate ' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Sends an e-mail message.

SYNTAX


Send-MailMessage [-To] <string[]> [-Subject] <string> -From <string> [[-Body] <string>] [[-SmtpServer] <string>] [-Attachments <string[]>] [-Bcc
<string[]>] [-BodyAsHtml] [-Cc <string[]>] [-Credential <PSCredential>] [-DeliveryNotificationOption {None | OnSuccess | OnFailure | Delay | Neve
r}] [-Encoding <Encoding>] [-Priority {Normal | Low | High}] [-UseSsl] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Send-MailMessage cmdlet sends an e-mail message from within Windows PowerShell.



<

RELATED LINKS


Online version: http://go.microsoft.com/fwlink/?LinkID=135256

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>send-mailmessage -to "User01 <user01@example.com>" -from "User02 <user02@example.com>" -subject "Test mail"



Description
-----------
This command sends an e-mail message from User01 to User02.

The mail message has a subject, which is required, but it does not have a body, which is optional. Also, because the SmtpServer parameter is not
specified, Send-MailMessage uses the value of the $PSEmailServer preference variable for the SMTP server.








-------------------------- EXAMPLE 2 --------------------------

C:\PS>send-mailmessage -from "User01 <user01@example.com>" -to "User02 <user02@example.com>", "User03 <user03@example.com>" -subject "Sending the
Attachment" -body "Forgot to send the attachment. Sending now." -Attachment "data.csv" -priority High -dno onSuccess, onFailure -smtpServer smtp
.fabrikam.com



Description
-----------
This command sends an e-mail message with an attachment from User01 to two other users.

It specifies a priority value of "High" and requests a delivery notification by e-mail when the e-mail messages are delivered or when they fail.








-------------------------- EXAMPLE 3 --------------------------

C:\PS>send-mailmessage -to "User01 <user01@example.com>" -from "ITGroup <itdept@example.com>" -cc "User02 <user02@example.com>" -bcc ITMgr <itmgr
@example.com> -subject "Don't forget today's meeting!" -credential domain01\admin01 -useSSL



Description
-----------
This command sends an e-mail message from User01 to the ITGroup mailing list with a copy (CC) to User02 and a blind carbon copy (BCC) to the IT m
anager (ITMgr).

The command uses the credentials of a domain administrator and the UseSSL parameter.