ForwardEmail.Net
1.0.0
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.6.2
This package targets .NET Framework 4.6.2. The package is compatible with this framework or higher.
dotnet add package ForwardEmail.Net --version 1.0.0
NuGet\Install-Package ForwardEmail.Net -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="ForwardEmail.Net" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ForwardEmail.Net" Version="1.0.0" />
<PackageReference Include="ForwardEmail.Net" />
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 ForwardEmail.Net --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ForwardEmail.Net, 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 ForwardEmail.Net@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=ForwardEmail.Net&version=1.0.0
#tool nuget:?package=ForwardEmail.Net&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ForwardEmail.Net
A .NET client library for the Forward Email API.
Installation
dotnet add package ForwardEmail.Net
Getting Started
You'll need a Forward Email API key from your account security settings.
Basic setup
using ForwardEmail.Net;
var client = new ForwardEmailClient(new ForwardEmailClientOptions
{
ApiKey = "your-api-key"
});
ASP.NET Core / Dependency Injection
Register the client with the DI container (recommended for web applications):
// Program.cs
builder.Services.AddForwardEmailClient("your-api-key");
// Or use the options overload for custom configuration
builder.Services.AddForwardEmailClient(options =>
{
options.ApiKey = "your-api-key";
options.BaseUrl = "https://api.forwardemail.net"; // default
});
Then inject it into your services:
public class MyService(ForwardEmailClient client)
{
// use client
}
Using an existing HttpClient
// Useful in test scenarios or when you manage HttpClient lifetime yourself
var httpClient = new HttpClient();
var client = new ForwardEmailClient(httpClient, new ForwardEmailClientOptions
{
ApiKey = "your-api-key"
});
Usage Examples
Account
// Get current account
var account = await client.GetAccountAsync();
Console.WriteLine($"Email: {account?.Email}, Plan: {account?.Plan}");
// Update account profile
var updated = await client.UpdateAccountAsync(new UpdateAccountRequest
{
GivenName = "Jane",
FamilyName = "Doe"
});
Domains
// List all domains
var domains = await client.ListDomainsAsync();
// Create a domain
var domain = await client.CreateDomainAsync(new CreateDomainRequest
{
Domain = "example.com",
HasPhishingProtection = true,
HasVirusProtection = true
});
// Get a specific domain
var domain = await client.GetDomainAsync("example.com");
// Verify DNS records
var verified = await client.VerifyDomainRecordsAsync("example.com");
// Delete a domain
bool deleted = await client.DeleteDomainAsync("example.com");
Aliases
// List aliases for a domain
var aliases = await client.ListAliasesAsync("example.com");
// Create an alias
var alias = await client.CreateAliasAsync("example.com", new CreateAliasRequest
{
Name = "hello",
Recipients = new List<string> { "you@gmail.com" },
Description = "Main contact alias",
HasImap = true
});
// Get a specific alias by ID
var alias = await client.GetAliasAsync("example.com", aliasId);
// Update an alias (e.g., enable vacation responder)
var updated = await client.UpdateAliasAsync("example.com", aliasId, new UpdateAliasRequest
{
VacationResponderIsEnabled = true,
VacationResponderSubject = "Out of office",
VacationResponderMessage = "I'll be back on Monday."
});
// Disable an alias
await client.UpdateAliasAsync("example.com", aliasId, new UpdateAliasRequest
{
IsEnabled = false
});
// Generate a password for IMAP/SMTP access
var result = await client.GenerateAliasPasswordAsync("example.com", aliasId,
new GenerateAliasPasswordRequest
{
NewPassword = "s3cr3tPassword!",
EmailedInstructions = "you@gmail.com"
});
// Delete an alias
bool deleted = await client.DeleteAliasAsync("example.com", aliasId);
Outbound Emails
// Check sending limit
var limit = await client.GetEmailLimitAsync();
Console.WriteLine($"Remaining: {limit?.Count}");
// Send an email
var email = await client.CreateEmailAsync(new CreateEmailRequest
{
From = "hello@example.com",
To = "recipient@example.com",
Subject = "Hello from ForwardEmail.Net",
Text = "Plain text body.",
Html = "<p>HTML body.</p>"
});
Console.WriteLine($"Email ID: {email?.Id}");
// List sent emails
var emails = await client.ListEmailsAsync(page: 1, limit: 25);
// Get a specific email
var email = await client.GetEmailAsync(emailId);
// Delete an email
bool deleted = await client.DeleteEmailAsync(emailId);
Catch-All Passwords
// List catch-all passwords for a domain
var passwords = await client.ListCatchAllPasswordsAsync("example.com");
// Create a catch-all password
var password = await client.CreateCatchAllPasswordAsync("example.com",
new CreateCatchAllPasswordRequest
{
NewPassword = "s3cr3tPassword!",
Description = "Shared inbox password"
});
// Delete a catch-all password by token ID
bool deleted = await client.DeleteCatchAllPasswordAsync("example.com", tokenId);
Domain Members & Invites
// Invite a user to a domain
await client.CreateInviteAsync("example.com", new CreateInviteRequest
{
Email = "colleague@example.com",
Group = "user" // or "admin"
});
// Remove an invite
await client.RemoveInviteAsync("example.com", "colleague@example.com");
// Update a member's role
await client.UpdateMemberAsync("example.com", memberId, "admin");
// Remove a member
await client.RemoveMemberAsync("example.com", memberId);
Logs
// Download logs as raw bytes (save to file or process in memory)
byte[]? logs = await client.DownloadLogsAsync(domain: "example.com");
if (logs != null)
await File.WriteAllBytesAsync("logs.csv", logs);
// Filter logs by search query or bounce category
byte[]? bounceLogs = await client.DownloadLogsAsync(
domain: "example.com",
bounceCategory: "hard"
);
Encrypt a TXT Record
This endpoint does not require authentication.
string? encrypted = await client.EncryptAsync("forward-email=you@gmail.com");
Console.WriteLine(encrypted); // use this value in your DNS TXT record
Error Handling
API errors throw a ForwardEmailException containing the HTTP status code and error message:
try
{
var domain = await client.GetDomainAsync("nonexistent.com");
}
catch (ForwardEmailException ex)
{
Console.WriteLine($"Status: {(int)ex.StatusCode} – {ex.ErrorMessage}");
}
Cancellation
All async methods accept an optional CancellationToken:
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
var account = await client.GetAccountAsync(cts.Token);
Target Frameworks
- .NET Framework 4.6.2
- .NET Standard 2.0 (includes ASP.NET Core DI extension)
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.2
- System.Text.Json (>= 8.0.5)
-
.NETStandard 2.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- System.Text.Json (>= 8.0.5)
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 | 114 | 4/23/2026 |