A high-performance .NET client library for the tempmail.plus API.
Add the TempMailNET library to your project references.
dotnet add package TempMailNETusing TempMailNET;Initialize the client with a username alias and a valid domain constant.
// Standard initialization
var client = new TempMailClient("johndoe", TempMailClient.FexpostCom);
// Optional: Inject a shared HttpClient for connection pooling
var sharedHttpClient = new HttpClient();
var clientWithPool = new TempMailClient("johndoe", TempMailClient.FexpostCom, sharedHttpClient);Available Domains:
TempMailClient.MailtoPlusTempMailClient.FexpostComTempMailClient.FexboxOrgTempMailClient.MailboxInUaTempMailClient.RoverInfoTempMailClient.ChitthiInTempMailClient.FextempComTempMailClient.AnyPinkTempMailClient.MerepostCom
Retrieve the hidden email address associated with the mailbox.
string secretAddress = await client.GetSecretAddressAsync();Fetch the inbox to see the latest messages. This returns a MailResponse object containing the list of items.
var inbox = await client.GetMailsAsync();
if (inbox != null)
{
Console.WriteLine($"Total emails: {inbox.Count}");
foreach (var item in inbox.MailList)
{
Console.WriteLine($"[{item.Time}] {item.FromName}: {item.Subject}");
}
}The wrapper object returned by GetMailsAsync.
- Count (
int): Total number of emails returned. - Result (
bool): API success status. - More (
bool): Indicates if there are more emails on the server. - Limit (
int): The limit applied to the request (default 20). - FirstId (
int): The ID of the newest email. - LastId (
int): The ID of the oldest email in this batch. - MailList (
MailListItem[]): Array of email summaries (see below).
Represents a single email summary in the inbox list.
- MailId (
int): Unique identifier for the email (used to fetch details). - Subject (
string): The email subject line. - Time (
string): The time received (e.g., "10:30"). - FromMail (
string): The sender's email address. - FromName (
string): The sender's display name. - IsNew (
bool): True if the email has not been read. - AttachmentCount (
int): Number of attachments. - FirstAttachmentName (
string): Filename of the first attachment, if any.
Fetch the full content of a specific message using its ID. This returns a MailDetail object.
var email = await client.GetMailAsync(12345); // ID from MailListItem
if (email != null)
{
Console.WriteLine(email.Text); // Plain text body
Console.WriteLine(email.Html); // HTML body
}Represents the full content of a specific email.
- MailId (
int): Unique identifier. - MessageId (
string): The SMTP message-id header. - Subject (
string): The email subject. - Date (
string): Full date and time string. - From (
string): Full sender string (Name ). - FromName (
string): Sender's display name. - FromMail (
string): Sender's email address. - FromIsLocal (
bool): True if sender is within the same system. - To (
string): Recipient address. - Text (
string): Plain text body content. - Html (
string): HTML body content. - IsTls (
bool): True if received via TLS. - Attachments (
Attachment[]): Array of attachment details (see below). - Result (
bool): API success status.
You can access attachment metadata via MailDetail and generate download links.
if (email.Attachments.Length > 0)
{
foreach (var att in email.Attachments)
{
string url = client.GetAttachmentLink(att.AttachmentId, email.MailId, email.Attachments);
Console.WriteLine($"File: {att.Name} ({att.Size} bytes) -> {url}");
}
}Represents a file attached to an email.
- AttachmentId (
int): Unique identifier for the attachment. - Name (
string): The filename (e.g., "document.pdf"). - Size (
int): File size in bytes.
The library avoids throwing exceptions for runtime network errors.
GetMailsAsync: Returnsnullon failure.GetMailAsync: Returnsnullon failure.GetSecretAddressAsync: Returnsstring.Emptyon failure.- Constructor: Throws
ArgumentExceptionif the alias is empty or domain is invalid.