MYDev.XunZhongSms 1.0.0-preview.5

This is a prerelease version of MYDev.XunZhongSms.
dotnet add package MYDev.XunZhongSms --version 1.0.0-preview.5
                    
NuGet\Install-Package MYDev.XunZhongSms -Version 1.0.0-preview.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MYDev.XunZhongSms" Version="1.0.0-preview.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MYDev.XunZhongSms" Version="1.0.0-preview.5" />
                    
Directory.Packages.props
<PackageReference Include="MYDev.XunZhongSms" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MYDev.XunZhongSms --version 1.0.0-preview.5
                    
#r "nuget: MYDev.XunZhongSms, 1.0.0-preview.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MYDev.XunZhongSms@1.0.0-preview.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MYDev.XunZhongSms&version=1.0.0-preview.5&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MYDev.XunZhongSms&version=1.0.0-preview.5&prerelease
                    
Install as a Cake Tool

MYDev.XunZhongSms 讯众短信 SDK

.NET SDK for 讯众短信服务,提供企业级短信发送解决方案。

功能特性

  • 完整的讯众短信 API 接口封装
  • 基于 .NET Standard 2.0 构建,支持跨平台
  • 支持营销类和通知类短信发送
  • 集成依赖注入扩展
  • 自动签名处理
  • 异常处理与错误信息封装

配置

appsettings.json 中添加配置:

{
  "XunZhongSms": {
    "AccountType": "通知/营销",
    "UserName": "your-username",
    "Password": "your-password",
    "Subject": "【签名】"
  }
}

Startup.csProgram.cs 中注册服务:

// 注册服务
services.AddXunZhongSms();

// 配置选项
services.Configure<XunZhongSmsOptions>(configuration.GetSection("XunZhongSms"));

核心概念

  • 短信发送:支持单条或多条短信发送
  • 账户类型:支持营销类和通知类短信通道
  • 自动签名:自动为短信内容添加签名前缀

API 请求列表

短信发送 (Send)

请求类 接口说明 端点
XunZhongSmsRequests.SendRequest 发送短信 send.do

使用示例

发送短信

var request = XunZhongSmsRequests.ToSend(new XunZhongSmsRequests.SendModel
{
    Mobile = "13800138000",
    Message = "您的验证码是:123456"
});

var response = await sender.SendAsync(request, xunzhongSmsOptions);

通过ISmsSender发送短信

var smsSender = serviceProvider.GetService<ISmsSender>();
await smsSender.SendAsync(new SmsMessage
{
    PhoneNumber = "13800138000",
    Text = "您的验证码是:123456"
});

异常处理

所有 API 错误都会在响应中体现,可以通过检查 SendResponse 的 IsSucceed 属性判断是否成功。

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-preview.5 68 5/18/2026
1.0.0-preview.4 71 4/27/2026
1.0.0-preview.3 206 12/4/2025
1.0.0-preview.2 649 12/2/2025
1.0.0-preview.1 163 11/27/2025