CSharp Email API for DotNET and ASP

Receiving emails in DotNET Core with C# and MailSlurp: A comprehensive guide for setting up and managing email addresses in C# using MailSlurp API.

  • Table of contents

read email csharp

MailSlurp is a powerful, free API for creating real email addresses in C#, F#, and DotNET. You can send and receive email addresses from tests and applications and manage your accounts using a webapp.

Get started

CSharp email examples

First add the .NET email package from Nuget:

dotnet add package mailslurp
dotnet restore

Then create a configuration with your api key. Next create an email account using the inbox controller.

using mailslurp.Api;
using mailslurp.Client;
using mailslurp.Model;

var config = new Configuration();
config.ApiKey.Add("x-api-key", "your_api_key_here");

// now create an email address
var apiInstance = new InboxControllerApi(config);
var inbox = apiInstance.CreateInbox();

Assert.NotNull(inbox);
Assert.Contains("@mailslurp.com", inbox.EmailAddress);
Email and SMS Platform
Create a free account in 3 clicks