Duta.Net 0.2.0

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

Duta.Net

The official .NET SDK for Duta, transactional email for Malaysia.

  • .NET 8+. Async throughout, with CancellationToken.
  • services.AddDuta(...) for ASP.NET Core and any host with dependency injection.
  • Retries rate limits and server errors safely: every send carries an idempotency key, so a retry can never send twice.

Upgrading from 0.1.x

0.2.0 is a new SDK for Duta's current API, not an update of 0.1.x, which was written for an earlier version of Duta that no longer runs.

Install

dotnet add package Duta.Net

ASP.NET Core

builder.Services.AddDuta(o => o.ApiKey = builder.Configuration["Duta:ApiKey"]);

Then inject DutaClient wherever you send mail:

app.MapPost("/orders/{id}/receipt", async (string id, DutaClient duta) =>
{
    var sent = await duta.Emails.SendAsync(new SendEmailRequest
    {
        From = "Kedai <resit@kedai.my>",
        To = ["siti@example.com"],
        Subject = "Resit #1042",
        Html = "<p>Terima kasih.</p>",
    }, new SendOptions(IdempotencyKey: $"receipt-{id}"));
    return sent.Id;
});

Without dependency injection

var duta = new DutaClient(Environment.GetEnvironmentVariable("DUTA_API_KEY"));
var sent = await duta.Emails.SendAsync(email);

Keep one DutaClient for the life of the app. Errors throw DutaException: Code is Duta's error code and RequestId finds the request on the Logs screen.

try
{
    await duta.Emails.SendAsync(email);
}
catch (DutaException e)
{
    logger.LogError("Send failed: {Code} {RequestId}", e.Code, e.RequestId);
}

Batch and paging

await duta.Batch.SendAsync([first, second], new BatchOptions(Validation: "permissive"));

await foreach (var email in duta.Emails.ListAllAsync(new EmailListParams { Status = "bounced" }))
    Console.WriteLine(email.Id);

Verify webhooks

var body = await new StreamReader(Request.Body).ReadToEndAsync(); // the raw body
var evt = WebhookSignature.Verify(
    body,
    Request.Headers.ToDictionary(h => h.Key, h => h.Value.ToString()),
    configuration["Duta:WebhookSecret"]);

It throws WebhookVerificationException when the signature is wrong or the delivery is more than five minutes old.

Everything else

Emails SendAsync, GetAsync, ListAsync, ListAllAsync
Batch SendAsync
Domains CreateAsync, ListAsync, GetAsync, VerifyAsync, RemoveAsync
ApiKeys CreateAsync, ListAsync, RemoveAsync
Webhooks CreateAsync, ListAsync, GetAsync, RemoveAsync, EnableAsync, TestAsync, DeliveriesAsync, Verify
Suppressions CreateAsync, ListAsync, ListAllAsync, RemoveAsync
Logs ListAsync, ListAllAsync, GetAsync
Usage GetAsync

Options: new DutaClientOptions { ApiKey, BaseUrl, MaxRetries = 2, Timeout = 30s }.

Full documentation: https://docs.duta.indra.sh

Product 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.

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
0.2.0 36 9/25/2026
0.1.5 119 6/15/2026
0.1.0 114 6/14/2026