Skip to content

.NET SDK

The official .NET client. Targets .NET 8.

Terminal window
dotnet add package Duta.Net
using Duta;
var duta = new DutaClient("duta_live_xxx");
var result = await duta.Emails.SendAsync(new SendEmailOptions
{
From = "hello@yourdomain.com",
To = new[] { "user@example.com" },
Subject = "Welcome",
Html = "<p>Thanks for signing up!</p>",
});
Console.WriteLine($"Sent: {result.Id}");

Methods throw DutaException on failure:

try
{
await duta.Emails.SendAsync(options);
}
catch (DutaException e)
{
Console.WriteLine($"{e.StatusCode} {e.Name}: {e.Message}");
// e.Name: authentication_error | permission_denied | rate_limit_exceeded | ...
}
  • duta.Emails.SendAsync(options): send an email. Returns SendEmailResult.
  • duta.Emails.GetAsync(id): retrieve an email. Requires a full-access key.
  • duta.Emails.ListAsync(page, limit): list emails. Requires a full-access key.

Pass your own HttpClient to the constructor to reuse a shared instance in long-running apps.

Package: nuget.org/packages/Duta.Net · Source: github.com/indra-sh/duta-dotnet.