-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[release/5.0] [wasm][net] System.Net.Mail should not throw PNSE for f…
…ull assembly. (#43213) Co-authored-by: Kenneth Pouncey <kjpou@pt.lu>
- Loading branch information
1 parent
b928f03
commit d90f149
Showing
16 changed files
with
233 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 160 additions & 0 deletions
160
src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Browser.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using System.Runtime.Versioning; | ||
using System.Security.Cryptography.X509Certificates; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace System.Net.Mail | ||
{ | ||
public delegate void SendCompletedEventHandler(object sender, AsyncCompletedEventArgs e); | ||
|
||
public enum SmtpDeliveryMethod | ||
{ | ||
Network, | ||
SpecifiedPickupDirectory, | ||
PickupDirectoryFromIis | ||
} | ||
|
||
// EAI Settings | ||
public enum SmtpDeliveryFormat | ||
{ | ||
SevenBit = 0, // Legacy | ||
International = 1, // SMTPUTF8 - Email Address Internationalization (EAI) | ||
} | ||
|
||
[UnsupportedOSPlatform("browser")] | ||
public class SmtpClient : IDisposable | ||
{ | ||
#pragma warning disable CS0067 // Field is not used | ||
public event SendCompletedEventHandler? SendCompleted; | ||
#pragma warning restore CS0067 | ||
public SmtpClient() | ||
{ | ||
Initialize(); | ||
} | ||
|
||
public SmtpClient(string? host) | ||
{ | ||
Initialize(); | ||
} | ||
|
||
public SmtpClient(string? host, int port) | ||
{ | ||
Initialize(); | ||
} | ||
|
||
private void Initialize() | ||
{ | ||
throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public string? Host | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public int Port | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public bool UseDefaultCredentials | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public ICredentialsByHost? Credentials | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public int Timeout | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public ServicePoint ServicePoint | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public SmtpDeliveryMethod DeliveryMethod | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public SmtpDeliveryFormat DeliveryFormat | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
public string? PickupDirectoryLocation | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
/// <summary> | ||
/// <para>Set to true if we need SSL</para> | ||
/// </summary> | ||
public bool EnableSsl | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
/// <summary> | ||
/// Certificates used by the client for establishing an SSL connection with the server. | ||
/// </summary> | ||
public X509CertificateCollection ClientCertificates => throw new PlatformNotSupportedException(); | ||
|
||
public string? TargetName | ||
{ | ||
get => throw new PlatformNotSupportedException(); | ||
set => throw new PlatformNotSupportedException(); | ||
} | ||
|
||
private bool ServerSupportsEai => throw new PlatformNotSupportedException(); | ||
|
||
public void Send(string from, string recipients, string? subject, string? body) => throw new PlatformNotSupportedException(); | ||
|
||
public void Send(MailMessage message) => throw new PlatformNotSupportedException(); | ||
|
||
public void SendAsync(string from, string recipients, string? subject, string? body, object? userToken) => throw new PlatformNotSupportedException(); | ||
|
||
public void SendAsync(MailMessage message, object? userToken) => throw new PlatformNotSupportedException(); | ||
|
||
public void SendAsyncCancel() => throw new PlatformNotSupportedException(); | ||
|
||
//************* Task-based async public methods ************************* | ||
public Task SendMailAsync(string from, string recipients, string? subject, string? body) => throw new PlatformNotSupportedException(); | ||
|
||
public Task SendMailAsync(MailMessage message) => throw new PlatformNotSupportedException(); | ||
|
||
public Task SendMailAsync(string from, string recipients, string? subject, string? body, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); | ||
|
||
public Task SendMailAsync(MailMessage message, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); | ||
|
||
protected void OnSendCompleted(AsyncCompletedEventArgs e) => throw new PlatformNotSupportedException(); | ||
|
||
public void Dispose() | ||
{ | ||
Dispose(true); | ||
GC.SuppressFinalize(this); | ||
} | ||
|
||
protected virtual void Dispose(bool disposing) | ||
{ } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.