Skip to content

Commit 5b34163

Browse files
gautamdshethGautam Sheth
and
Gautam Sheth
authored
Update PowerShell version requirements and added warning about SendEmail API retirement (#4558)
Co-authored-by: Gautam Sheth <gautam.sheth@staffbase.com>
1 parent e6cbff6 commit 5b34163

File tree

6 files changed

+40
-164
lines changed

6 files changed

+40
-164
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
3838

3939
### Changed
4040

41-
- **PnP PowerShell is now .NET 8.0 based, and requires PowerShell 7.4.3 or newer **
41+
- **PnP PowerShell is now .NET 8.0 based, and requires PowerShell 7.4.4 or newer **
4242
- **`-Interactive` login is now the default.**
4343
- In case of errors when Graph batch method is used, it will now throw a clearer error message about what was the issue. [#4327](https://github.com/pnp/powershell/pull/4327/)
4444
- `Get-PnPAccessToken`, `Request-PnPAccessToken` and `Get-PnPGraphAccessToken` output type is changed to `Microsoft.IdentityModel.JsonWebTokens.JsonWebToken`. Earlier they returned `System.IdentityModel.Tokens.Jwt`.
@@ -55,6 +55,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
5555
- When passing in an existing connection using `-Connection` on `Connect-PnPOnline`, the clientid from the passed in connection will be used for the new connection [#4425](https://github.com/pnp/powershell/pull/4425)
5656
- Removed `-Confirm` parameter from `Remove-PnPUser` and `Remove-PnPAvailableSiteClassification` cmdlets. Use `-Force` instead. [#4455](https://github.com/pnp/powershell/pull/4455)
5757
- `Get-PnPFile` now also supports passing in a full SharePoint Online URL [#4480](https://github.com/pnp/powershell/pull/4480)
58+
- `Send-PnPMail` now throws a warning about the retirement of the SharePoint SendEmail API.
5859

5960
### Fixed
6061

@@ -81,6 +82,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
8182
- Removed `Get-PnPPowerPlatformConnector` alias. You need to use `Get-PnPPowerPlatformCustomConnector`. [#4387](https://github.com/pnp/powershell/pull/4387)
8283
- Removed `-IsFavoriteByDefault` parameter from `Add-PnPTeamsChannel` cmdlet. It was obsolete and not supported by Graph API. [#4387](https://github.com/pnp/powershell/pull/4387)
8384
- Removed `Get-PnPAppAuthAccessToken` , `Remove-PnPGraphAccessToken` and `Request-PnPAccessToken` cmdlets. Use `Get-PnPAccessToken` instead. [#4398](https://github.com/pnp/powershell/pull/4398)
85+
- Removed support for sending mail via SMTP. It's usage is not recommended by .NET due to its lack of support for modern protocols.
8486

8587
### Contributors
8688

MIGRATE-2.0-to-3.0.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
_This is a draft document, version 3 is not yet available. You can try this out with the nightly builds starting from 2.99.1 or later_
44

5-
The 3.x version of PnP PowerShell is based exclusively on .NET 8.0, which means that it will not work on older PowerShell editions like PowerShell 5.1, ISE or PowerShell 7.3 or older. It will work only on **PowerShell 7.4 or later editions.**
5+
The 3.x version of PnP PowerShell is based exclusively on .NET 8.0, which means that it will not work on older PowerShell editions like PowerShell 5.1, ISE or PowerShell 7.3 or older. It will work only on **PowerShell 7.4.4 or later editions.**
66

77
## Steps to update from 2.x to 3.x
88

@@ -16,7 +16,7 @@ Or
1616

1717
- For Mac OS environments, please use [this link](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos)
1818

19-
Once the PowerShell 7.4 or later is downloaded and installed in the environment, you can install the PnP PowerShell module like you normally do.
19+
Once the PowerShell 7.4.4 or later is downloaded and installed in the environment, you can install the PnP PowerShell module like you normally do.
2020

2121
```powershell
2222
Install-Module -Name "PnP.PowerShell"
@@ -30,7 +30,7 @@ Install-Module -Name "PnP.PowerShell" -AllowPrerelease
3030

3131
## Changes needed in Azure DevOps/GitHub Actions/Pipelines
3232

33-
If you are using PnP PowerShell in Azure Devops, GitHub Actions or other pipeline infrastructure, you will have to update your PowerShell version from v5 to v7.4 or later.
33+
If you are using PnP PowerShell in Azure Devops, GitHub Actions or other pipeline infrastructure, you will have to update your PowerShell version from v5 to v7.4.4 or later.
3434

3535
Recommend referring to these 2 links:
3636

@@ -54,6 +54,9 @@ Recommend referring to these 2 links:
5454
| Get-PnPGraphAccessToken | It has been removed. Use `Get-PnPAccessToken` instead. |
5555
| Remove-PnPUser | The parameter `-Confirm` has been removed. Use `-Force` instead. |
5656
| Remove-PnPAvailableSiteClassification | The parameter `-Confirm` has been removed. Use `-Force` instead. |
57+
| Send-PnPMail | It now throws a warning about the retirement of SharePoint SendEmail API, if you are sending mails via SharePoint. To ignore it, use `-ErrorAction SilentlyContinue` along side the cmdlet. |
58+
| Send-PnPMail | The support for sending mails via SMTP servers is now removed. It is the recommendation of .NET as SMTP doesn't support modern protocols. So, the parameters `-EnableSSL` , `-UserName`, `-Password`, `-Server ` and `-ServerPort` are now removed. Use `Send-PnPMail` with [Microsoft Graph](https://pnp.github.io/powershell/cmdlets/Send-PnPMail.html#send-through-microsoft-graph) |
59+
5760

5861
## Other notable changes
5962

documentation/Send-PnPMail.md

Lines changed: 4 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,9 @@ Send-PnPMail -From <String> -To <String[]> -Subject <String> -Body <String> [-Cc
2626
Send-PnPMail -To <String[]> -Subject <String> -Body <String> [-Cc <String[]>] [-Bcc <String[]>] [-Connection <PnPConnection>] [-Verbose]
2727
```
2828

29-
### Send through SMTP
30-
31-
```powershell
32-
Send-PnPMail -Server <String> -From <String> -To <String[]> -Subject <String> -Body <String> [-Cc <String[]>] [-Bcc <String[]>] [-Importance <MessageImportanceType>] [-BodyContentType <MessageBodyContentType>] [-ServerPort <short>] [-EnableSsl <bool>] [-Username <String>] [-Password <String>] [-Connection <PnPConnection>] [-Verbose]
33-
```
34-
3529
## DESCRIPTION
3630

37-
Allows sending an e-mail through SharePoint Online, SMTP or Microsoft Graph. Sending e-mail through Microsoft Graph requires the Mail.Send permission.
31+
Allows sending an e-mail through SharePoint Online or Microsoft Graph. Sending e-mail through Microsoft Graph requires the **Mail.Send** permission.
3832

3933
## EXAMPLES
4034

@@ -59,27 +53,6 @@ Send-PnPMail -To "address@tenant.microsoftonline.com" -Subject "Test message" -B
5953

6054
Sends an e-mail using the SharePoint Online SendEmail method using the current context. E-mail is sent from the SharePoint Online no-reply e-mail address and can only be sent to accounts in the same tenant. The from address will show the title of the site you are connected with along with the e-mail address no-reply@sharepointonline.com.
6155

62-
### EXAMPLE 4
63-
```powershell
64-
Send-PnPMail -From "user@contoso.onmicrosoft.com" -To "recipient@contoso.onmicrosoft.com" -Subject "Test message" -Body "This is a test message" -Server contoso.mail.protection.outlook.com
65-
```
66-
67-
Sends an e-mail via the SMTP service belonging to a specific tenant. E-mail is sent from the user specified in the From parameter and can be sent only to addresses residing in the tenant you address through the Server parameter, in this case contoso.
68-
69-
### EXAMPLE 5
70-
```powershell
71-
Send-PnPMail -From "user@contoso.onmicrosoft.com" -To "recipient@contoso.com" -Subject "Test message" -Body "This is a test message" -Server smtp.myisp.com
72-
```
73-
74-
Sends an e-mail via a custom SMTP server of your Internet Service Provider which does not require authentication and uses port TCP 25. E-mail is sent from the user specified in the From parameter and can be sent to both internal and external addresses.
75-
76-
### EXAMPLE 6
77-
```powershell
78-
Send-PnPMail -From "user@contoso.onmicrosoft.com" -To "recipient@contoso.com" -Subject "Test message" -Body "This is a test message" -Server smtp.myisp.com -Port 587 -EnableSsl:$true -Username "userxyz" -Password "password123"
79-
```
80-
81-
Sends an e-mail via a custom SMTP server of your Internet Service Provider which requires authentication and uses SSL over port TCP 587. E-mail is sent from the user specified in the From parameter and can be sent to both internal and external addresses.
82-
8356
## PARAMETERS
8457

8558
### -Body
@@ -129,7 +102,7 @@ Allows defining what type of content is in the Body parameter. Defaults to HTML.
129102
130103
```yaml
131104
Type: MessageBodyContentType
132-
Parameter Sets: Send through Microsoft Graph, Send through SMTP
105+
Parameter Sets: Send through Microsoft Graph
133106
Accepted values: Html, Text
134107

135108
Required: False
@@ -153,26 +126,12 @@ Accept pipeline input: False
153126
Accept wildcard characters: False
154127
```
155128
156-
### -EnableSsl
157-
Allows you to specify if SSL should be used when connecting to the SMTP server. Only used when the Server parameter is specified.
158-
159-
```yaml
160-
Type: Boolean
161-
Parameter Sets: Send through SMTP
162-
163-
Required: False
164-
Position: Named
165-
Default value: False
166-
Accept pipeline input: False
167-
Accept wildcard characters: False
168-
```
169-
170129
### -From
171130
The sender of the e-mail. When Microsoft Graph is used, this can be a user or a shared mailbox.
172131
173132
```yaml
174133
Type: String
175-
Parameter Sets: Send through SMTP, Send through Microsoft Graph
134+
Parameter Sets: Send through Microsoft Graph
176135

177136
Required: True
178137
Position: Named
@@ -186,7 +145,7 @@ Allows defining what the importance of the e-mail is. Defaults to Normal.
186145
187146
```yaml
188147
Type: MessageImportanceType
189-
Parameter Sets: Send through Microsoft Graph, Send through SMTP
148+
Parameter Sets: Send through Microsoft Graph
190149
Accepted values: Low, Normal, High
191150

192151
Required: False
@@ -196,34 +155,6 @@ Accept pipeline input: False
196155
Accept wildcard characters: False
197156
```
198157
199-
### -Username
200-
Username to use to authenticate to the outbound mailserver. Only used when the Server parameter is specified and if not provided, an anonymous connection will be made with the SMTP server specified through Server.
201-
202-
```yaml
203-
Type: String
204-
Parameter Sets: Send through SMTP
205-
206-
Required: False
207-
Position: Named
208-
Default value: None
209-
Accept pipeline input: False
210-
Accept wildcard characters: False
211-
```
212-
213-
### -Password
214-
Password to use to authenticate to the outbound mailserver. Only used when the Server parameter is specified and if not provided, an anonymous connection will be made with the SMTP server specified through Server.
215-
216-
```yaml
217-
Type: String
218-
Parameter Sets: Send through SMTP
219-
220-
Required: False
221-
Position: Named
222-
Default value: None
223-
Accept pipeline input: False
224-
Accept wildcard characters: False
225-
```
226-
227158
### -ReplyTo
228159
List of return addresses to use for the e-mail
229160
@@ -252,34 +183,6 @@ Accept pipeline input: False
252183
Accept wildcard characters: False
253184
```
254185
255-
### -Server
256-
SMTP server to use to send the e-mail. You can use the SMTP server of your Internet Service Provider or the SMTP server of your tenant by using tenant.mail.protection.outlook.com where you replace tenant with your own tenant name. This allows you to send e-mail without requiring any authentication, but only to recipients in that tenant. Use a custom SMTP server if you want to send e-mail to various external recipients or go for the Microsoft Graph option in which case you don't specify a server.
257-
258-
```yaml
259-
Type: String
260-
Parameter Sets: Send through SMTP
261-
262-
Required: True
263-
Position: Named
264-
Default value: None
265-
Accept pipeline input: False
266-
Accept wildcard characters: False
267-
```
268-
269-
### -ServerPort
270-
SMTP server port to use to send the e-mail. Used in combination with the Server parameter. Defaults to 25.
271-
272-
```yaml
273-
Type: String
274-
Parameter Sets: Send through SMTP
275-
276-
Required: False
277-
Position: Named
278-
Default value: None
279-
Accept pipeline input: False
280-
Accept wildcard characters: False
281-
```
282-
283186
### -Subject
284187
Subject of the email
285188

pages/articles/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Installing PnP PowerShell
22

3-
You need PowerShell 7.4 or later to use PnP PowerShell. It is available for Windows, Linux and Mac and can be [installed through here](https://learn.microsoft.com/powershell/scripting/install/installing-powershell).
3+
You need PowerShell 7.4.4 or later to use PnP PowerShell. It is available for Windows, Linux and Mac and can be [installed through here](https://learn.microsoft.com/powershell/scripting/install/installing-powershell).
44

55
## Stable build
66

@@ -34,7 +34,7 @@ docker run -it m365pnp/powershell
3434

3535
# Updating PnP PowerShell
3636

37-
If you already have PnP PowerShell installed and just want to update to the latest version you can follow these steps. If you're not sure if your version is already up to date, it does no harm to run it anyway. If there's no new version available, it will not do anything. You need PowerShell 7.4 or later to use PnP PowerShell. It is available for Windows, Linux and Mac and can be [installed through here](https://learn.microsoft.com/powershell/scripting/install/installing-powershell).
37+
If you already have PnP PowerShell installed and just want to update to the latest version you can follow these steps. If you're not sure if your version is already up to date, it does no harm to run it anyway. If there's no new version available, it will not do anything. You need PowerShell 7.4.4 or later to use PnP PowerShell. It is available for Windows, Linux and Mac and can be [installed through here](https://learn.microsoft.com/powershell/scripting/install/installing-powershell).
3838

3939
## Stable build
4040

src/Commands/PnP.PowerShell.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
</ItemGroup>
125125

126126
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-windows'">
127-
<PackageReference Include="System.Management.Automation" Version="7.4.4" />
127+
<PackageReference Include="System.Management.Automation" Version="7.4.4" />
128128
<PackageReference Include="TextCopy" Version="6.2.1" />
129129
</ItemGroup>
130130

0 commit comments

Comments
 (0)