The C# email SDK for .NET: receive, read and send mail.
Receive email in C# without configuring a mail server. Create an address, await the next message, read its text, HTML and attachments, and reply in the thread. Every call is async, mail is stored encrypted, and it is opened inside your .NET process.
Mailcycle on NuGet · .NET 8 or later · Apache 2.0 · Free tier, no card
Receive and send email in C# and .NET.
Sign in, create an address, wait for a message and answer it. That is the whole loop, and it is the same loop whether the mail is a sign-up code, a customer or a receipt.
- 1Install Mailcycle and set MAILCYCLE_PHRASE to your account's recovery phrase.
- 2Create an address with mc.Addresses.CreateAsync(). It receives mail straight away.
- 3Wait for the next message with mc.Messages.WaitForAsync(), or take it from a webhook.
- 4Reply with mc.Messages.SendAsync(), threaded under the original.
The whole email API, from .NET.
Everything the Mailcycle console can do is in the package: addresses, inbound mail, sending, webhooks, events, API keys and devices.
Create email addresses from .NET
mc.Addresses.CreateAsync() mints a new address on a shared domain, or on your own domain from Scale, and it receives mail at once. Give it a prefix and a label sealed on your machine.
Receive email and wait for it
mc.Messages.WaitForAsync() listens on the event stream and returns the next matching message, filtered by sender or subject, opened and ready to read. Without a stream it checks every five seconds.
Read and parse incoming email
mc.Messages.AllAsync() and .AttachmentAsync() return the sender, subject, plain text, the original HTML, a safe HTML with remote images and trackers removed, and every attachment as bytes.
Send email and reply in the thread
mc.Messages.SendAsync() sends from an address your account owns, with up to ten files. Pass the message you are answering and the threading headers are filled in.
Inbound email webhooks
Register a URL and every message.received event is POSTed to it, signed with HMAC-SHA256 and retried. WebhookSignature.VerifyNow() checks the signature in one line.
A live event stream
mc.Events.Stream() carries the same events over a WebSocket the moment they happen, and reconnects after a drop. Events carry ids, never content.
Test email verification in xUnit, NUnit, MSTest and Playwright for .NET.
Create an address in a test fixture, drive your sign-up page with Playwright, then await WaitForAsync and read the code from message.Text. A timeout throws an ApiException with Code "timeout", and a CancellationToken stops the wait when the test run is cancelled.
- A real address on a real domain, so the mail goes through the same path your users' does.
- One call blocks until the message lands, filtered by subject or sender, with a timeout you set.
- Text, HTML and attachments come back parsed, so pulling out a code or a link is a regular expression.
- Mail received from the moment you start waiting counts, even if it lands before the stream is up.
Handle incoming email in ASP.NET Core, Azure Functions and Worker Services.
Rather than polling, let the mail come to you. A webhook POSTs each event to your URL the moment it happens, signed so you can prove it came from Mailcycle, and retried if your server is down.
Events carry ids, never content. Fetch the message by id and it is opened in your code, exactly as it would be otherwise. Webhooks are on Operator and above.
Instead of SmtpClient or MailKit and a mailbox.
Microsoft's own documentation steers new code away from System.Net.Mail.SmtpClient, and MailKit, the usual replacement, still needs an SMTP server to send through and an IMAP mailbox with a password to read from.
Here an address is one awaited call, mail arrives on a webhook or through WaitForAsync, and each message comes back parsed into a record: sender, subject, Text, SafeHtml with remote content removed, and attachments as byte arrays.
It is not a bulk sender. If you need newsletters or high volumes of transactional mail, use a sending service for that; Mailcycle is for addresses your code owns and the mail that comes back to them.
Mail is opened in your .NET code, not on our servers.
Each address has a key pair derived from your recovery phrase. Incoming mail is sealed to its public key before anything is written down, and the package derives the private key on your machine to open it.
- Signing in proves you hold the key by answering a challenge, so the phrase never crosses the wire.
- Bodies, attachments, address labels and API key names are all sealed. The server stores ciphertext.
- Mail sealed by one SDK opens in every other, and in the app, because they share one published format.
- The package is checked against Mailcycle's published test vectors, including the cases that must be refused.
- Because the server cannot read mail, there is no server-side search. Search runs where the mail is opened.
What developers build with the .NET SDK.
It runs in ASP.NET Core apps, Worker Services, Azure Functions and console tools: anywhere .NET code needs an email address of its own.
End-to-end tests for sign-up and login
Verification emails, one-time passcodes, magic links, password resets and invitations, checked by a real test in xUnit, NUnit, MSTest and Playwright for .NET.
A support or orders inbox your code answers
Give an address to a queue, read what customers send, and reply from the address they wrote to, threaded under their message.
Receipts, invoices and alerts as data
Point suppliers, monitoring and other services at an address and pull the text and attachments straight into your own records.
An address per customer, job or device
Mint addresses on demand and keep each stream of mail separate, with its own label, and delete one when the job is done.
Building an AI agent? It can have an inbox too, through the Mailcycle MCP server, without writing any .NET at all.
C# and .NET SDK at a glance.
Maintained by Mailcycle, the team that runs the API.
| Package | Mailcycle |
|---|---|
| Registry | NuGet |
| Install with | dotnet CLI or the NuGet package manager |
| Needs | .NET 8 or later |
| Also | Every call is async and takes an optional CancellationToken. |
| Licence | Apache 2.0, free to use in your own applications |
| API | JSON over HTTPS at api.mailcycle.email |
| Guide | The .NET guide in the docs |
What each plan unlocks. Free receives mail. A signed-in session sends from Personal up. API keys and webhooks start at Operator, and sending from an API key at Scale. See pricing.
C# and .NET email SDK questions.
The same API in every language you use.
Nine SDKs share one encryption format, so a message created by one opens in all the others.