SmppSharp 1.4.1
dotnet add package SmppSharp --version 1.4.1
NuGet\Install-Package SmppSharp -Version 1.4.1
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="SmppSharp" Version="1.4.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SmppSharp" Version="1.4.1" />
<PackageReference Include="SmppSharp" />
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 SmppSharp --version 1.4.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SmppSharp, 1.4.1"
#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 SmppSharp@1.4.1
#: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=SmppSharp&version=1.4.1
#tool nuget:?package=SmppSharp&version=1.4.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SmppSharp
Lightweight SMPP 3.4 client for .NET 8+. No external dependencies.
Features
- Text SMS — auto-detect GSM7 (Latin) or UCS2 (Cyrillic, Arabic, Chinese, Hebrew, Greek, emoji)
- Long messages — automatic multipart splitting via UDH (default), SAR TLV, or
message_payloadTLV - Flash SMS — Class 0 messages displayed immediately without storing
- Binary SMS — raw byte payload (OTA configs, ringtones, etc.)
- WAP Push — Service Indication (SI) with URL and message text
- Fluent builder — intuitive
SubmitRequestBuilderAPI - MO & delivery receipts — receive incoming messages and status reports
- Bulk sending —
SubmitBulkAsyncwith concurrency control - Pipeline mode —
SubmitPipelineAsyncfor high-throughput campaigns (> 1000 msg/sec) - SSL/TLS — optional encrypted transport
- Auto-reconnect — configurable delay and retry limit
- Keepalive — automatic
enquire_linkheartbeat - Diagnostic Metrics —
System.Diagnostics.Metricsintegration (OpenTelemetry, Prometheus) - ASP.NET Core DI —
AddSmpp()extension withIHostedService
Installation
dotnet add package SmppSharp
Quick start
var client = new SmppClient(new SmppOptions
{
Host = "smpp.provider.com",
Port = 2775,
SystemId = "login",
Password = "password",
});
client.OnMessageReceived += async msg => Console.WriteLine($"MO: {msg.SourceAddress} → {msg.Message}");
client.OnDeliveryReceived += async receipt => Console.WriteLine($"DR: {receipt.MessageId} = {receipt.Status}");
client.OnDisconnected += ex => Console.WriteLine($"Disconnected: {ex?.Message}");
client.OnReconnected += () => Console.WriteLine("Reconnected!");
await client.ConnectAsync();
var result = await client.SubmitAsync(new SubmitRequest
{
SourceAddress = "MYAPP",
DestinationAddress = "+998901234567",
Message = "Ваш код: 1234",
});
Console.WriteLine($"Sent! MessageId={result.MessageId}, Segments={result.SegmentCount}");
Fluent builder
var request = new SubmitRequestBuilder()
.From("PAYOMAK")
.To("+998901234567")
.Text("Ваш код: 4521")
.WithDeliveryReport()
.WithCorrelationId("order-99")
.ValidFor(TimeSpan.FromHours(24))
.Build();
await client.SubmitAsync(request);
Flash SMS
Displayed immediately on the handset — not saved to inbox.
var request = new SubmitRequestBuilder()
.From("ALERT")
.To("+998901234567")
.Text("Внимание! Ваш счёт заблокирован.")
.Flash()
.Build();
await client.SubmitAsync(request);
Binary SMS
var request = new SubmitRequestBuilder()
.From("SVC")
.To("+998901234567")
.Binary(new byte[] { 0x01, 0x02, 0x03, 0xAB })
.Build();
await client.SubmitAsync(request);
WAP Push
Sends a Service Indication (SI) — opens a URL on the user's handset.
using SmppSharp.Builders;
var request = WapPushBuilder.CreateSi(
sourceAddress: "PAYOMAK",
destinationAddress: "+998901234567",
url: "https://payomak.uz/promo",
message: "Нажмите для просмотра акции",
signal: WapPushSignal.Medium);
await client.SubmitAsync(request);
Available signals: None, Low, Medium, High, Delete.
Bulk sending
var requests = phones.Select(phone => new SubmitRequestBuilder()
.From("PAYOMAK")
.To(phone)
.Text("Акция! Скидка 20% до конца месяца.")
.Build());
var results = await client.SubmitBulkAsync(requests, maxConcurrency: 20);
Console.WriteLine($"Sent: {results.Count}");
High-throughput pipeline (> 1000 msg/sec)
Streams requests and yields results as they complete — no need to buffer everything in memory.
var requests = GetRequestsAsync(); // IAsyncEnumerable<SubmitRequest>
await foreach (var result in client.SubmitPipelineAsync(requests, concurrency: 100))
{
Console.WriteLine($"Sent: {result.MessageId} ({result.SegmentCount} segments)");
}
SSL/TLS
var client = new SmppClient(new SmppOptions
{
Host = "smpp.provider.com",
Port = 3550,
SystemId = "login",
Password = "password",
UseSsl = true,
// SslTargetHost = "smpp.provider.com", // optional, defaults to Host
// AllowUntrustedCertificate = true, // dev only
});
ASP.NET Core DI
// Program.cs
builder.Services.AddSmpp(opt =>
{
opt.Host = "smpp.provider.com";
opt.Port = 2775;
opt.SystemId = "login";
opt.Password = "password";
});
// Inject ISmppClient wherever needed
public class SmsService(ISmppClient smpp)
{
public Task SendAsync(string phone, string text) =>
smpp.SubmitAsync(new SubmitRequest
{
SourceAddress = "MYAPP",
DestinationAddress = phone,
Message = text,
});
}
Observability (OpenTelemetry / Prometheus)
// Register metrics listener
builder.Services.AddOpenTelemetry()
.WithMetrics(m => m.AddMeter(SmppMetrics.MeterName));
Available instruments:
| Metric | Type | Description |
|---|---|---|
smpp.messages.sent |
Counter | SMS segments successfully submitted |
smpp.messages.failed |
Counter | Failed submit operations |
smpp.messages.received |
Counter | MO messages received |
smpp.receipts.received |
Counter | Delivery receipts received |
smpp.reconnects.total |
Counter | Reconnect attempts |
smpp.submit.duration |
Histogram (ms) | Round-trip time for submit_sm |
smpp.connections.active |
UpDownCounter | Currently bound connections |
Configuration reference
new SmppOptions
{
Host = "localhost",
Port = 2775,
SystemId = "",
Password = "",
SystemType = "",
BindMode = BindMode.Transceiver, // Transmitter | Receiver | Transceiver
EnquireLinkInterval = TimeSpan.FromSeconds(30),
ResponseTimeout = TimeSpan.FromSeconds(30),
ReconnectDelay = TimeSpan.FromSeconds(5),
AutoReconnect = true,
MaxReconnectAttempts = 0, // 0 = infinite
UseSsl = false,
SslTargetHost = null,
AllowUntrustedCertificate = false,
UseUdh = true, // multipart via UDH; false = SAR TLV
UseMessagePayload = false, // send long message as single PDU via message_payload TLV
}
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net8.0
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.