SendBase.Email 1.0.0

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

SendBase.Email SDK

Official .NET SDK for the SendBase Email API.

Installation

dotnet add package SendBase.Email

Quick Start

using SendBase.Email;
using SendBase.Email.Models.Requests;

var client = new SendBaseClient("your-api-key");

var response = await client.Emails.SendAsync(new SendEmailRequest
{
    FromEmail = "sender@yourdomain.com",
    FromName = "Your App",
    To = ["recipient@example.com"],
    Subject = "Hello from SendBase!",
    HtmlBody = "<h1>Welcome!</h1><p>This is a test email.</p>"
});

Console.WriteLine($"Message ID: {response.MessageId}");

Dependency Injection

using SendBase.Email.Extensions;

builder.Services.AddSendBaseClient(options =>
{
    options.ApiKey = builder.Configuration["SendBase:ApiKey"]!;
    options.BaseUrl = "https://api.yourdomain.com";
    options.Timeout = TimeSpan.FromSeconds(30);
    options.Retry = new RetryPolicyOptions
    {
        MaxRetries = 3,
        InitialDelay = TimeSpan.FromMilliseconds(500)
    };
});

// Inject ISendBaseClient
public class EmailService(ISendBaseClient client)
{
    public async Task SendWelcomeEmail(string email)
    {
        await client.Emails.SendAsync(new SendEmailRequest
        {
            FromEmail = "welcome@yourdomain.com",
            To = [email],
            Subject = "Welcome!",
            HtmlBody = "<h1>Welcome to our service!</h1>"
        });
    }
}

Features

Send Emails

// Simple send
await client.Emails.SendAsync(new SendEmailRequest
{
    FromEmail = "sender@domain.com",
    To = ["recipient@example.com"],
    Subject = "Test",
    HtmlBody = "<h1>Hello</h1>"
});

// With attachments
await client.Emails.SendAsync(new SendEmailRequest
{
    FromEmail = "sender@domain.com",
    To = ["recipient@example.com"],
    Subject = "Report",
    HtmlBody = "<p>Please see attached report.</p>",
    Attachments =
    [
        EmailAttachment.FromBytes("report.pdf", pdfBytes, "application/pdf"),
        EmailAttachment.FromUrl("image.png", "https://example.com/image.png")
    ]
});

// Batch send
var batch = await client.Emails.SendBatchAsync(new SendBatchEmailRequest
{
    Emails =
    [
        new SendEmailRequest { FromEmail = "sender@domain.com", To = ["user1@example.com"], Subject = "Hi", HtmlBody = "Hello 1" },
        new SendEmailRequest { FromEmail = "sender@domain.com", To = ["user2@example.com"], Subject = "Hi", HtmlBody = "Hello 2" }
    ]
});

Domains

// Create domain
var domain = await client.Domains.CreateAsync(new CreateDomainRequest { Domain = "example.com" });

// List domains
var domains = await client.Domains.ListAsync();

// Verify domain
var verification = await client.Domains.VerifyAsync(domain.Id);

// Enable inbound
await client.Domains.EnableInboundAsync(domain.Id);

Templates

// Create template
var template = await client.Templates.CreateAsync(new CreateTemplateRequest
{
    Name = "Welcome Email",
    Subject = "Welcome {{name}}!",
    HtmlBody = "<h1>Hello {{name}}</h1><p>Welcome to our service.</p>"
});

// Preview with variables
var preview = await client.Templates.PreviewAsync(template.Id, new Dictionary<string, object>
{
    ["name"] = "John"
});

// Send using template
await client.Emails.SendAsync(new SendEmailRequest
{
    FromEmail = "sender@domain.com",
    To = ["recipient@example.com"],
    Subject = "Welcome",
    TemplateId = template.Id,
    TemplateData = new Dictionary<string, object> { ["name"] = "John" }
});

Webhooks

// Create webhook
var webhook = await client.Webhooks.CreateAsync(new CreateWebhookRequest
{
    Url = "https://yourapp.com/webhooks/email",
    Events = [WebhookEventType.EmailDelivered, WebhookEventType.EmailBounced]
});

// Test webhook
var test = await client.Webhooks.TestAsync(webhook.Id);

// Get delivery history
var deliveries = await client.Webhooks.GetDeliveriesAsync(webhook.Id);

Error Handling

using SendBase.Email.Exceptions;

try
{
    await client.Emails.SendAsync(request);
}
catch (SendBaseValidationException ex)
{
    Console.WriteLine($"Validation error: {ex.Message}");
}
catch (SendBaseAuthenticationException)
{
    Console.WriteLine("Invalid API key");
}
catch (SendBaseRateLimitException ex)
{
    Console.WriteLine($"Rate limited. Retry after: {ex.RetryAfter}");
}
catch (SendBaseNotFoundException)
{
    Console.WriteLine("Resource not found");
}
catch (SendBaseException ex)
{
    Console.WriteLine($"API error: {ex.Message} (Status: {ex.StatusCode})");
}

Available Clients

Client Description
client.Emails Send and manage emails
client.Domains Manage sending domains
client.Templates Manage email templates
client.Messages View sent messages
client.Inbound Manage inbound emails
client.ApiKeys Manage API keys
client.Webhooks Manage webhooks
client.Billing Manage billing and subscription
client.Tenants Manage tenants and members

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.0 172 12/12/2025