Alternatives to MailSlurp

alternatives to mailslurp

MailSlurp is an email testing API that let’s you create real email addresses for tests, code, and online using the MailSlurp email testing app.

Email testing services

Some common alternatives to MailSlurp include:

  • Mailinator
  • Mailosaur
  • Testmail
  • MailTrapd
  • MailCheck

Unique features

features

  • MailSlurp has been around for a long time and is constantly improving.
  • It has official APIs in many languages and a simple REST API.
  • Advanced wait for and filter results: with MailSlurp you can wait on and filter for emails like no other service.

How to use MailSlurp

mailslurp

MailSlurp can be used in code, integration tests, or using the online dashboard.

Testing email addresses

Then use the returned attachment IDs in the SendEmailOptions of your email send call.

Here are some examples using CSharp and DotNet:

[TestMethod]
public void Can_Receive_Email_Contents_And_Attachments()
{
    
    // create two inboxes and send an email between them
    var inboxControllerApi = new InboxControllerApi(_config);
    var inbox1 = inboxControllerApi.CreateInbox();
    var inbox2 = inboxControllerApi.CreateInbox();
    
    // send email with attachment from inbox 1 to inbox 2
    var sendEmailOptions = new SendEmailOptions(
        // send to inbox 2
        to: new List<string> {inbox2.EmailAddress},
        subject: "Hello inbox 2",
        body: "Here is your attachment",
        isHTML: true,
        attachments: _uploadAttachment()
    );
    inboxControllerApi.SendEmail(inbox1.Id, sendEmailOptions);
    
    // now wait for email to arrive in inbox 2
    var waitForControllerApi = new WaitForControllerApi(_config);
    var email = waitForControllerApi.WaitForLatestEmail(inboxId: inbox2.Id, timeout: 30000, unreadOnly: true);
    
    // validate received email
    StringAssert.Contains(email.Body, "Here is your attachment");
    StringAssert.Contains(email.Subject, "Hello inbox 2");
    Assert.IsTrue(email.Attachments.Count > 0);
    
    // fetch attachment
    var emailControllerApi = new EmailControllerApi(_config);
    var downloadAttachmentDto = emailControllerApi.DownloadAttachmentBase64(attachmentId: email.Attachments.First(), emailId: email.Id);

    StringAssert.Contains(downloadAttachmentDto.ContentType, "text/plain");
    Assert.IsNotNull(downloadAttachmentDto.SizeBytes);
    Assert.IsNotNull(downloadAttachmentDto.Base64FileContents); // convert to bytes if you wish to parse or save file
}

Get sent emails

[TestMethod]
public void Can_Get_Sent_Emails()
{
    
    var sentEmailsControllerApi = new SentEmailsControllerApi(_config);
    var inboxControllerApi = new InboxControllerApi(_config);
    
    var inbox = inboxControllerApi.CreateInbox();
    var sentEmails = sentEmailsControllerApi.GetSentEmails(inboxId:inbox.Id, page:0, size: 20);
    
    Assert.IsNotNull(sentEmails.Content);
    Assert.IsNotNull(sentEmails.TotalPages);
    Assert.AreEqual(sentEmails.Pageable.PageNumber, 0);
    Assert.AreEqual(sentEmails.Pageable.PageSize, 20);
}

Extract email content

[TestMethod]
public void Can_Extract_Codes()
{
    
    // create an inbox
    var inboxControllerApi = new InboxControllerApi(_config);
    var inbox = inboxControllerApi.CreateInbox();
    
    // send a code to the inbox
    var sendEmailOptions = new SendEmailOptions(
        to: new List<string>() {inbox.EmailAddress},
        subject: "Welcome email",
        body: "Hello. Your code is X-456"
    );
    inboxControllerApi.SendEmail(inbox.Id, sendEmailOptions);
    
    // wait for the email to arrive
    var waitForController = new WaitForControllerApi(_config);
    var emailController = new EmailControllerApi(_config);
    var email = waitForController.WaitForLatestEmail(inboxId:inbox.Id, timeout: 30000, unreadOnly: true);
    StringAssert.Contains(email.Body, "Hello");
    
    // extract the code
    var matchOptions = new ContentMatchOptions(pattern:"Your code is ([A-Z]-[0-9]{3})");
    var matchResults = emailController.GetEmailContentMatch(email.Id, matchOptions);
    Assert.AreEqual(matchResults.Matches[1], "X-456");
}

MailSlurp has powerful code and visual dashboard features.

Create team inboxes

Share emails and attachments with team email access.

View spam ratings and attachments online

Virus check email contents or use machine learning spam analysis to score your emails.

spam

Perform email HTML verification and more.