Skip to content

Latest commit

 

History

History
160 lines (119 loc) · 3.52 KB

Send-PnPMail.md

File metadata and controls

160 lines (119 loc) · 3.52 KB
external help file applicable schema
SharePoint Server 2013, SharePoint Server 2016, SharePoint Online
2.0.0

Send-PnPMail

SYNOPSIS

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>]
             [-Connection <SPOnlineConnection>]

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.

PARAMETERS

-Body

Body of the email

Type: String
Parameter Sets: (All)

Required: True
Position: Named
Accept pipeline input: False

-Cc

List of recipients on CC

Type: String[]
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-From

If using from address, you also have to provide a password

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Password

If using a password, you also have to provide the associated from address

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Server

Type: String
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Subject

Subject of the email

Type: String
Parameter Sets: (All)

Required: True
Position: Named
Accept pipeline input: False

-To

List of recipients

Type: String[]
Parameter Sets: (All)

Required: True
Position: Named
Accept pipeline input: False

-Connection

Optional connection to be used by cmdlet. Retrieve the value for this parameter by eiter specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type: SPOnlineConnection
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

-Web

This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.

Type: WebPipeBind
Parameter Sets: (All)

Required: False
Position: Named
Accept pipeline input: False

RELATED LINKS

SharePoint Developer Patterns and Practices