Table of contents
TOC
Collapse the table of content
Expand the table of content

Send-PnPMail

Bert Jansen|Last Updated: 2/20/2017
|
1 Contributor

Sends an email using the Office 365 SMTP Service or SharePoint, depending on the parameters specified. See detailed help for more information.

Syntax

Send-PnPMail -To <String[]>
             -Subject <String>
             -Body <String>
             [-Server <String>]
             [-From <String>]
             [-Password <String>]
             [-Cc <String[]>]
             [-Web <WebPipeBind>]

Parameters

ParameterTypeRequiredDescription
BodyStringTrueBody of the email
SubjectStringTrueSubject of the email
ToString[]TrueList of recipients
CcString[]FalseList of recipients on CC
FromStringFalseIf using from address, you also have to provide a password
PasswordStringFalseIf using a password, you also have to provide the associated from address
ServerStringFalse
WebWebPipeBindFalseThe web to apply the command to. Omit this parameter to use the current web.

Examples

Example 1

PS:> Send-PnPMail -To address@tenant.sharepointonline.com -Subject test -Body test

Sends an e-mail using the SharePoint SendEmail method using the current context. E-mail is sent from the system account and can only be sent to accounts in the same tenant

Example 2

PS:> Send-PnPMail -To address@contoso.com -Subject test -Body test -From me@tenant.onmicrosoft.com -Password xyz

Sends an e-mail via Office 365 SMTP and requires a from address and password. E-mail is sent from the from user and can be sent to both internal and external addresses.

Example 3

PS:> Send-PnPMail -To address@contoso.com -Subject test -Body test -From me@server.net -Password xyz -Server yoursmtp.server.net

Sends an e-mail via a custom SMTP server and requires a from address and password. E-mail is sent from the from user.

© 2017 Microsoft