DirectIQ 1.0.2

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

DirectIQ .NET SDK

The official .NET SDK for DirectIQ — send transactional email from .NET applications with a simple, dependency-injection-friendly client. Targets .NET 8.0+.

Installing via NuGet

Package is published on NuGet.

From the command-line:

> dotnet add package DirectIQ

From within Visual Studio using the Package Manager Console:

PM> Install-Package DirectIQ

Configure

Register the client with dependency injection at startup:

builder.Services.AddDirectIQ(o =>
{
    o.ApiKey = Environment.GetEnvironmentVariable("DIRECTIQ_APIKEY")!;
});

Get your API key from the DirectIQ dashboard.

Usage

Inject IDirectIQ wherever you need to send email:

using DirectIQ;

public class FeatureImplementation
{
    private readonly IDirectIQ _directiq;

    public FeatureImplementation(IDirectIQ directiq)
    {
        _directiq = directiq;
    }

    public async Task Execute()
    {
        var message = new EmailMessage();
        message.From = "from@example.com";
        message.To.Add("to@example.com");
        message.Subject = "Hello!";
        message.HtmlBody = "<div><strong>Greetings</strong> from .NET</div>";

        await _directiq.EmailSendAsync(message);
    }
}

Plain text

Set TextBody instead of HtmlBody to send a plain-text email:

var message = new EmailMessage();
message.From = "from@example.com";
message.To.Add("to@example.com");
message.Subject = "Hello!";
message.TextBody = "Greetings from .NET";

await _directiq.EmailSendAsync(message);

HtmlBody takes precedence if both are set, so use one or the other rather than both.

Attachments

message.Attachments.Add(EmailAttachment.FromFile("invoice.pdf"));

Error handling

Failed requests throw a DirectIQException with the HTTP status code and raw response body:

try
{
    await _directiq.EmailSendAsync(message);
}
catch (DirectIQException ex)
{
    logger.LogError(ex, "DirectIQ send failed with {StatusCode}: {Body}", ex.StatusCode, ex.ResponseBody);
}

Notes

DirectIQ's transactional email API currently accepts exactly one recipient per message (no cc, bcc, or multiple To addresses). EmailMessage.To is a collection for a future-friendly API surface, but must contain exactly one address today.

License

MIT

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
1.0.2 114 7/31/2026