Pandatech.Communicator 3.0.0

dotnet add package Pandatech.Communicator --version 3.0.0
                    
NuGet\Install-Package Pandatech.Communicator -Version 3.0.0
                    
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="Pandatech.Communicator" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pandatech.Communicator" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Pandatech.Communicator" />
                    
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 Pandatech.Communicator --version 3.0.0
                    
#r "nuget: Pandatech.Communicator, 3.0.0"
                    
#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 Pandatech.Communicator@3.0.0
                    
#: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=Pandatech.Communicator&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Pandatech.Communicator&version=3.0.0
                    
Install as a Cake Tool

PandaTech.Communicator

A lightweight .NET library for sending Email and SMS through a simple DI-friendly API.

  • Email: SMTP submission via MailKit (works with Gmail, Microsoft 365, Mailgun, SendGrid SMTP, etc.)
  • SMS: Built-in integrations:
    • Dexatel
    • Twilio

Target framework: .NET 9


Install

dotnet add package PandaTech.Communicator

Concepts

Channels

Channels let you configure multiple providers/senders and choose one at runtime per message.

Built-in channel constants:

EmailChannels.GeneralSender
EmailChannels.TransactionalSender
EmailChannels.NotificationSender
EmailChannels.MarketingSender
EmailChannels.SupportSender

SmsChannels.GeneralSender
SmsChannels.TransactionalSender
SmsChannels.NotificationSender
SmsChannels.MarketingSender
SmsChannels.SupportSender

Setup

You can configure the library in Program.cs or via appsettings.json. Both are supported.

Option A: WebApplicationBuilder

var builder = WebApplication.CreateBuilder(args);

builder.AddCommunicator();

Option B: IServiceCollection

services.AddCommunicator(configuration);

Fake mode

For local/dev testing you can enable fake services:

  • SmsFake: true — does not call providers
  • EmailFake: true — does not send email

Configuration (appsettings.json)

Minimal example

{
    "Communicator": {
        "SmsFake": true,
        "EmailFake": false,
        "EmailConfigurations": {
            "GeneralSender": {
                "SmtpServer": "smtp.gmail.com",
                "SmtpPort": 587,
                "SmtpUsername": "info@yourdomain.com",
                "SmtpPassword": "APP_PASSWORD",
                "SenderEmail": "info@yourdomain.com",
                "TimeoutMs": 15000
            }
        }
    }
}

Full example (SMS + Email)

{
    "Communicator": {
        "SmsFake": false,
        "SmsConfigurations": {
            "GeneralSender": {
                "Provider": "Dexatel",
                "From": "sender_name",
                "Properties": {
                    "X-Dexatel-Key": "your-key"
                },
                "TimeoutMs": 10000
            },
            "TransactionalSender": {
                "Provider": "Twilio",
                "From": "sender_number",
                "Properties": {
                    "SID": "your-sid",
                    "AUTH_TOKEN": "your-token"
                },
                "TimeoutMs": 10000
            }
        },
        "EmailFake": false,
        "EmailConfigurations": {
            "GeneralSender": {
                "SmtpServer": "smtp.gmail.com",
                "SmtpPort": 587,
                "SmtpUsername": "info@yourdomain.com",
                "SmtpPassword": "APP_PASSWORD",
                "SenderEmail": "info@yourdomain.com",
                "SenderName": "Your App",
                "TimeoutMs": 15000
            }
        }
    }
}

TLS behavior (Email)

Email TLS is inferred by port:

  • 465 → implicit TLS (SSL-on-connect)
  • 587 → STARTTLS (recommended)

Configuration (Program.cs)

If you prefer to configure everything in code:

builder.AddCommunicator(options =>
{
  options.SmsFake = false;
  options.EmailFake = false;

  options.SmsConfigurations = new()
  {
    ["GeneralSender"] = new SmsConfiguration
    {
      Provider = "Dexatel",
      From = "sender_name",
      Properties = new Dictionary<string, string>
      {
        ["X-Dexatel-Key"] = "your-key"
      },
      TimeoutMs = 10000
    }
  };

  options.EmailConfigurations = new()
  {
    ["GeneralSender"] = new EmailConfiguration
    {
      SmtpServer = "smtp.gmail.com",
      SmtpPort = 587,
      SmtpUsername = "info@yourdomain.com",
      SmtpPassword = "APP_PASSWORD",
      SenderEmail = "info@yourdomain.com",
      SenderName = "Your App",
      TimeoutMs = 15000
    }
  };
});

Usage

Services

Inject and use:

  • ISmsService
  • IEmailService
app.MapPost("/send/sms", async (ISmsService sms, CancellationToken ct) =>
{
  var msg = new SmsMessage
  {
    Recipients = ["+374XXXXXXXX"],
    Message = "Hello",
    Channel = SmsChannels.GeneralSender
  };

  var result = await sms.SendAsync(msg, ct);
  return Results.Ok(result);
});
app.MapPost("/send/email", async (IEmailService email, CancellationToken ct) =>
{
  var msg = new EmailMessage
  {
    Recipients = ["user@example.com"],
    Subject = "Hello",
    Body = "Hi from PandaTech.Communicator",
    IsBodyHtml = false,
    Channel = EmailChannels.GeneralSender
  };

  var response = await email.SendAsync(msg, ct);
  return Results.Ok(new { response });
});

Message models

SMS

public class SmsMessage
{
  public List<string> Recipients { get; set; } = null!;
  public string Message { get; set; } = null!;
  public string Channel { get; set; } = null!;
}

ISmsService returns List<GeneralSmsResponse>:

public class GeneralSmsResponse
{
  public string From { get; set; } = null!;
  public string To { get; set; } = null!;
  public string OuterSmsId { get; set; } = null!;
  public string Status { get; set; } = null!;
  public DateTime CreateDate { get; set; }
  public DateTime UpdateDate { get; set; }
  public string Body { get; set; } = null!;
}

Email

public class EmailMessage
{
  public List<string> Recipients { get; set; } = null!;
  public string Subject { get; set; } = null!;
  public string Body { get; set; } = null!;
  public List<string> Cc { get; set; } = [];
  public List<string> Bcc { get; set; } = [];
  public List<EmailAttachment> Attachments { get; set; } = [];
  public bool IsBodyHtml { get; set; } = false;
  public string Channel { get; set; } = null!;
}

IEmailService returns provider response strings:

  • SendAsyncstring
  • SendBulkAsyncList<string>

Example response (varies by provider):

2.0.0 OK <server-response-id>

Notes & troubleshooting

  • If you use Gmail, prefer 587 with an App Password (or OAuth2 outside SMTP).
  • Some hosting providers block outbound 465; 587 is typically allowed for SMTP submission.

License

MIT

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
3.0.0 0 12/29/2025
2.2.2 158 12/23/2025
2.2.1 158 12/23/2025
2.2.0 160 12/23/2025
2.1.4 185 8/16/2025
2.1.3 229 6/1/2025
2.1.2 176 2/17/2025
2.1.1 179 12/5/2024
2.1.0 176 11/26/2024
2.0.0 156 11/21/2024
1.0.6 226 8/15/2024
1.0.5 217 6/3/2024
1.0.4 186 5/30/2024
1.0.3 207 4/17/2024
1.0.2 235 2/23/2024
1.0.1 204 2/23/2024
1.0.0 215 2/23/2024
0.0.1 227 2/8/2024

Dotnet 10 upgrade