15 releases

0.1.15 Nov 7, 2024
0.1.14 Sep 29, 2024
0.1.11 Aug 3, 2024
0.1.10 Jun 22, 2022
0.1.4 May 31, 2022

#631 in Web programming

Download history 28/week @ 2024-08-10 37/week @ 2024-08-17 112/week @ 2024-08-24 13/week @ 2024-08-31 251/week @ 2024-09-21 283/week @ 2024-09-28 17/week @ 2024-10-05 6/week @ 2024-10-12 2/week @ 2024-10-19 5/week @ 2024-10-26 132/week @ 2024-11-02 33/week @ 2024-11-09 25/week @ 2024-11-16 3/week @ 2024-11-23

194 downloads per month

MIT license

43KB
1K SLoC

alibaba-cloud-sdk-rust

crates.io Released API docs GPL3 licensed Downloads of Crates.io Lines of code Build Languages

阿里云短信rust sdk

Example

use alibaba_cloud_sdk_rust::services::dysmsapi;
use gostd::strings;

const AliyunSmsServerRegion: &str = "cn-hangzhou";
const AliyunSmsAccessKeyID: &str = "LTAI4FwqPxiAxxxxxx";
const AliyunSmsAccessKeySecret: &str = "xxxxx0FJqHTTLwDUuhxxxxx";
const AliyunSmsReportTempleateCode: &str = "SMS_226xxxx"; // 通知模版
const AliyunSmsSignName: &str = "阿里云"; // 短信署名

fn main()->Result<(), std::io::Error>{
    let phoneNumber="1391212xxxx";
    match  SendSMS(phoneNumber) {
        Ok(response)=> println!("{:?}",response),
        Err(err)=>println!("{}",err),
    }
}

fn SendSMS(phoneNumber: &str) -> Result<(), std::io::Error> {
    let mut client = dysmsapi::Client::NewClientWithAccessKey(
        AliyunSmsServerRegion,
        AliyunSmsAccessKeyID,
        AliyunSmsAccessKeySecret,
    )?;
    let mut request = dysmsapi::CreateSendSmsRequest();
    request.PhoneNumbers = strings::Replace(phoneNumber, "+86", "", -1);
    request.SignName = AliyunSmsSignName.to_owned();
    request.TemplateCode = AliyunSmsReportTempleateCode.to_owned();
    let response = client.SendSms(&mut request)?;
    println!("{:?}", &response);

    Ok(())
}

捐赠方式

If you like my open source project and would like to support me, you can donate through the following methods:

  • Dogecoin address DHbDfZWTYjpiGctAyYy1F9YzViTfVRW6aY
  • AliPay: limiao2008@gmail.com
  • ETH address: 0x74682cbE11De154E38D8B220ba177c28481F41a8
  • PayPal: paypal.me/wandercn

Thank you for your support!

Dependencies

~14–25MB
~454K SLoC