Giter Club home page Giter Club logo

abp.sms.tencentcloud's Introduction

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);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.