Skip to content

.NET Client

The official .NET SDK for VaultSandbox Gateway. It handles quantum-safe encryption automatically, letting you focus on testing email workflows.

  • Automatic Encryption: ML-KEM-768 key encapsulation + AES-256-GCM encryption handled transparently
  • Real-Time Delivery: SSE-based email delivery with smart polling fallback
  • Email Authentication: Built-in SPF/DKIM/DMARC validation helpers
  • Full Email Access: Decrypted content, headers, links, and attachments
  • Dependency Injection: First-class ASP.NET Core IServiceCollection integration
  • .NET 9.0+ (not supported in Blazor WebAssembly or browser runtimes)
  • VaultSandbox Gateway server
  • Valid API key

The SDK connects to a VaultSandbox Gateway - a receive-only SMTP server you self-host. It handles email reception, authentication validation, and encryption. You can run one with Docker in minutes.

See Gateway Overview or jump to Quick Start to deploy one.

using VaultSandbox.Client;
var client = VaultSandboxClientBuilder.Create()
.WithBaseUrl("https://gateway.example.com")
.WithApiKey("your-api-key")
.Build();
// Create inbox (keypair generated automatically)
var inbox = await client.CreateInboxAsync();
// Send email to inbox.EmailAddress from your application...
// Wait for email
var email = await inbox.WaitForEmailAsync(new WaitForEmailOptions
{
Timeout = TimeSpan.FromSeconds(30)
});
Console.WriteLine($"Subject: {email.Subject}");
Console.WriteLine($"Text: {email.Text}");
// Cleanup
await client.DeleteInboxAsync(inbox.EmailAddress);
await client.DisposeAsync();