The Mailosaur Developer Hub

Welcome to the Mailosaur developer hub. You'll find comprehensive guides and documentation to help you start working with Mailosaur as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Setting up Email Addresses for Testing

How you can generate a unique email address for any test.

When automating email testing, the simplest way of capturing email with Mailosaur is to use an @mailosaur.io email address.

How mailosaur.io email addresses work

Any email sent to an @mailosaur.io address is routed to Mailosaur. Any email address containing your Server's identifier will be captured and processed for testing.

In practice, this means that your Virtual SMTP server will capture any messages sent to email addresses ending with .SERVER_ID@mailosaur.io. Because of this pattern, you have an unlimited number of test email addresses to work with.

Can I use a unique email address for test or test run?

Yes! As mentioned above, the email address pattern that Mailosaur uses, allows you to prefix your email address with anything you like. Each one of these examples would go to the same mailbox:

  • build-55.SERVER_ID@mailosaur.io
  • joe+tester.SERVER_ID@mailosaur.io
  • 2017-01-08.SERVER_ID@mailosaur.io

Don't know what to enter for SERVER_ID? Just check out What is my Server ID?.

Can I generate a unique email address in my automation code?

Yes! Whilst you could write your own code to do this, based on the pattern above, each one of Mailosaur's official client libraries has a method to do this for you:

require "mailosaur"
client = Mailosaur::MailosaurClient.new("YOUR_API_KEY")

# Returns random address, e.g. ab234es.SERVER_ID@mailosaur.io
client.servers.generate_email_address("SERVER_ID")
from mailosaur import MailosaurClient
client = MailosaurClient("YOUR_API_KEY")

# Returns random address, e.g. ab234es.SERVER_ID@mailosaur.io
client.servers.generate_email_address("SERVER_ID")
Mailosaur client = new MailosaurClient("YOUR_API_KEY");

// Returns random address, e.g. ab234es.SERVER_ID@mailosaur.io
client.servers().generateEmailAddress("SERVER_ID")
const MailosaurClient = require('mailosaur');
const client = new MailosaurClient('YOUR_API_KEY');
            
// Returns random address, e.g. ab234es.SERVER_ID@mailosaur.io
client.servers.generateEmailAddress('SERVER_ID');
var client = new MailosaurClient("YOUR_API_KEY");

// Returns random address, e.g. ab234es.SERVER_ID@mailosaur.io
client.Servers.GenerateEmailAddress("SERVER_ID")