Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Abp.Sms.TencentCloud

ABP version NuGet NuGet Download Discord online GitHub stars

Abp TencentCloud SMS module.

Installation

  1. Install the following NuGet packages. (see how)

    • EasyAbp.Abp.Sms.TencentCloud
  2. Add DependsOn(typeof(AbpSmsTencentCloudModule)) attribute to configure the module dependencies. (see how)

Usage

  1. Configure by AbpTencentCloudCommonOptions and AbpTencentCloudSmsOptions.

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        Configure<AbpTencentCloudCommonOptions>(op =>
        {
            op.SecretId = "pUqsqkj1EhAYJXbSjRupWDviPAMyEaSrH5vY";
            op.SecretKey = "20DDOExLNQCTRcsogtP9AEQHI1Tcnu5R";
        });
        
        Configure<AbpTencentCloudSmsOptions>(op =>
        {
            op.DefaultSmsSdkAppid = "1400000000";
            op.DefaultSign = "多态科技";
        });
    }

    You can also use ABP settings to control the values of the above options. We recommend to you a great tool module to manage settings: Abp.SettingUI.

  2. Try to send a SMS message.

    var code = "123456";    // The generated verification code
    var templateId = "400000";  // TencentCloud SMS template ID
    var phoneNumber = "+8613000000000";
    
    var smsSender = ServiceProvider.GetRequiredService<ISmsSender>();
    
    // The "text" param has no effect in TencentCloud SMS, but it cannot be null or empty.
    const string text = "placeholder";
    var smsMessage = new SmsMessage(phoneNumber, text);
    smsMessage.Properties.Add(AbpSmsTencentCloudConsts.TemplateIdPropertyName, templateId);
    smsMessage.Properties.Add(AbpSmsTencentCloudConsts.TemplateParamSetPropertyName, new [] {code});
    
    await smsSender.SendAsync(smsMessage);

About

Abp TencentCloud SMS module.

Resources

Stars

15 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages