SmtpClient.SendMailAsync SmtpClient.SendMailAsync SmtpClient.SendMailAsync SmtpClient.SendMailAsync Method

Definition

Sends the specified message to an SMTP server for delivery as an asynchronous operation.

Overloads

SendMailAsync(MailMessage) SendMailAsync(MailMessage) SendMailAsync(MailMessage) SendMailAsync(MailMessage)

Sends the specified message to an SMTP server for delivery as an asynchronous operation.

SendMailAsync(String, String, String, String) SendMailAsync(String, String, String, String) SendMailAsync(String, String, String, String) SendMailAsync(String, String, String, String)

Sends the specified message to an SMTP server for delivery as an asynchronous operation. . The message sender, recipients, subject, and message body are specified using String objects.

SendMailAsync(MailMessage) SendMailAsync(MailMessage) SendMailAsync(MailMessage) SendMailAsync(MailMessage)

Sends the specified message to an SMTP server for delivery as an asynchronous operation.

public:
 System::Threading::Tasks::Task ^ SendMailAsync(System::Net::Mail::MailMessage ^ message);
public System.Threading.Tasks.Task SendMailAsync (System.Net.Mail.MailMessage message);
member this.SendMailAsync : System.Net.Mail.MailMessage -> System.Threading.Tasks.Task
Public Function SendMailAsync (message As MailMessage) As Task
Parameters
message
MailMessage MailMessage MailMessage MailMessage

A MailMessage that contains the message to send.

Returns

Returns Task.

The task object representing the asynchronous operation.

Exceptions

Remarks

This operation will not block. The returned Task> object will complete once the message has been sent.

SendMailAsync(String, String, String, String) SendMailAsync(String, String, String, String) SendMailAsync(String, String, String, String) SendMailAsync(String, String, String, String)

Sends the specified message to an SMTP server for delivery as an asynchronous operation. . The message sender, recipients, subject, and message body are specified using String objects.

public:
 System::Threading::Tasks::Task ^ SendMailAsync(System::String ^ from, System::String ^ recipients, System::String ^ subject, System::String ^ body);
public System.Threading.Tasks.Task SendMailAsync (string from, string recipients, string subject, string body);
member this.SendMailAsync : string * string * string * string -> System.Threading.Tasks.Task
Public Function SendMailAsync (from As String, recipients As String, subject As String, body As String) As Task
Parameters
from
String String String String

A String that contains the address information of the message sender.

recipients
String String String String

A String that contains the addresses that the message is sent to.

subject
String String String String

A String that contains the subject line for the message.

body
String String String String

A String that contains the message body.

Returns

Returns Task.

The task object representing the asynchronous operation.

Exceptions

Remarks

This operation will not block. The returned Task> object will complete once the message has been sent.

Applies to