Dela via


SmsClient.SendAsync Method

Definition

Overloads

SendAsync(String, IEnumerable<String>, String, SmsSendOptions, CancellationToken)

Sends an SMS message from a phone number that belongs to the authenticated account.

SendAsync(String, String, String, SmsSendOptions, CancellationToken)

Sends a SMS from a phone number that is acquired by the authenticated account, to another phone number.

SendAsync(String, IEnumerable<String>, String, SmsSendOptions, CancellationToken)

Source:
SmsClient.cs
Source:
SmsClient.cs

Sends an SMS message from a phone number that belongs to the authenticated account.

public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.SmsSendResult>>> SendAsync (string from, System.Collections.Generic.IEnumerable<string> to, string message, Azure.Communication.Sms.SmsSendOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member SendAsync : string * seq<string> * string * Azure.Communication.Sms.SmsSendOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.SmsSendResult>>>
override this.SendAsync : string * seq<string> * string * Azure.Communication.Sms.SmsSendOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.SmsSendResult>>>
Public Overridable Function SendAsync (from As String, to As IEnumerable(Of String), message As String, Optional options As SmsSendOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of IReadOnlyList(Of SmsSendResult)))

Parameters

from
String

The sender's phone number in E.164 format that is owned by the authenticated account.

to
IEnumerable<String>

The recipient's phone number in E.164 format. In this version, up to 100 recipients in the list is supported.

message
String

The contents of the message that will be sent to the recipient. The allowable content is defined by RFC 5724.

options
SmsSendOptions

Optional configuration for sending SMS messages.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

The server returned an error. See Message for details returned from the server.

message is null.

Applies to

SendAsync(String, String, String, SmsSendOptions, CancellationToken)

Source:
SmsClient.cs
Source:
SmsClient.cs

Sends a SMS from a phone number that is acquired by the authenticated account, to another phone number.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Sms.SmsSendResult>> SendAsync (string from, string to, string message, Azure.Communication.Sms.SmsSendOptions options = default, System.Threading.CancellationToken cancellationToken = default);
abstract member SendAsync : string * string * string * Azure.Communication.Sms.SmsSendOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Sms.SmsSendResult>>
override this.SendAsync : string * string * string * Azure.Communication.Sms.SmsSendOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Communication.Sms.SmsSendResult>>
Public Overridable Function SendAsync (from As String, to As String, message As String, Optional options As SmsSendOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of SmsSendResult))

Parameters

from
String

The sender's phone number that is owned by the authenticated account.

to
String

The recipient's phone number.

message
String

The contents of the message that will be sent to the recipient. The allowable content is defined by RFC 5724. If the message has more than 160 characters, the server will split it into multiple SMSs automatically.

options
SmsSendOptions

Optional configuration for sending SMS messages.

cancellationToken
CancellationToken

The cancellation token for the task.

Returns

Exceptions

The server returned an error. See Message for details returned from the server.

message is null.

Applies to