Hide

YetaWF.Core Package Documentation

Display
Print

YetaWF.Core.Support.SendSMS.SendSMS.SendMessageAsync Method

Sends an SMS message to a phone number or emails the specified text.

Class: YetaWF.Core.Support.SendSMS.SendSMS
Namespace: YetaWF.Core.Support.SendSMS
Assembly: YetaWF.Core

Syntax

public Task SendMessageAsync(
    string toNumber,
    string text,
    string? FromNumber = null,
    bool ThrowError = true );

Parameters

toNumber

Specify the phone number of the recipient. If toNumber specifies an email address, the text is emailed to the specified email address.

text

The text of the SMS message.

FromNumber

Optional sending number. If not specified, the SMS Settings are used to provide the default number.

ThrowError

If true is specified, an error exception is thrown if an error occurs sending the message, otherwise the method returns without any error indication.

Remarks

This is the general method to send an SMS, whether a receiving phone number is specified or a receiving email address. This allows the same method to be used to send an SMS using a provider that supports an SMS to email gateway (often free). This should only be used to send SMS/emails to known email addresses (for example, to the YetaWF site administrator) and can't be used for general users.

In order to use a phone number as toNumber, an SMS provider has to be installed. SMS providers offering SMS services are generally not free. When a phone number is used, it must be in E164 format (e.g., +14075551212).

See Also YetaWF.Core.Support.SendSMS.SendSMS ClassYetaWF.Core Overview