Email testing and validation

You can test key user journeys that involve email interactions using mabl Mailbox. For example, your test can test registering a user account, receiving verification email, clicking a link to verify the email address, and asserting that the email has been verified.


Enterprise feature

This feature is available to customers on the Enterprise plan, as well as all mabl trials.

What is mabl Mailbox?

Mailbox is an email service that mabl offers to help you test emails sent by your application under test. When training a test, you can generate a unique email address that the app can send emails to. You can then interact with and assert against all received emails using the mabl Trainer.

The Mailbox capabilities include:

  • An easy way for any user to create end-to-end tests that include email validation without the need for scripting or complex setups
  • Ability to follow links from emails in the same end-to-end test
  • Capturing screenshots of the email message and detecting visual changes over time
  • Ability to validate attachments and their metadata
  • Highly secure inbox that keeps your test emails safe

Furthermore, unlike traditional email testing approaches, email testing with mabl enables you to validate that there are no issues with your web application's email service provider. If there were such an issue, those emails will not reach your Mailbox and the test run will fail. Traditional email testing approaches typically intercept the emails sent by the app before they reach the email server and thus cannot alert you about issues with your email server or service provider.

Use cases

Mailbox is intended to be used for workflows that take an email address as an input such as:

  • User account registration
  • Web form submission notifications (e.g. Contact us)
  • Sending reports, invoices, reminders, etc. to user emails
  • Verifying attachments


Mailbox limitations

  • Your form validations and mail provider should support email addresses up to 25 characters long
  • Email address must be an input to the test and generated by mabl (not user supplied)
  • Email total size must be under 10 MiB (e.g. with attachments)
  • Mailbox email can only be received (asserted) in the same test that generated the address
  • Email must arrive within 5 minutes of the email assertion step, or the assertion will be failed

Testing emails

Below is a step-by-step tutorial that shows how you can generate a Mailbox address, use it to fill out a web form, receive an email upon form submission, and assert against the email to verify its contents as part of the end-to-end user test.

  1. Create or edit a test using the mabl Trainer
  2. Create a new variable and assign the mabl generated email address to it. You'll need to select "mabl mailbox address" in the "Set value from" dropdown that appears in the create variable form.


Custom Email Prefixes

You can also use custom email address prefixes to distinguish your emails.

For example, we'll assign the address to the variable email_1.

Creating a Mailbox email addressCreating a Mailbox email address

Creating a Mailbox email address

  1. Use the variable as an input to the email address field of a web form such as the one shown on the animation below.
Insert the Mailbox email address into a submission formInsert the Mailbox email address into a submission form

Insert the Mailbox email address into a submission form

Once you submit your form and send the email, the message will appear in the Mailbox email assertions menu.

  1. Click through the "Assertions > Email" menu to assert against a specific email. It may take a minute for the email to arrive from your email server. Use the refresh button on the mail screen to check for new mail.

  2. Click on the email of interest to open the assertion menu. You may assert against sender address and email subject.

Asserting against email propertiesAsserting against email properties

Asserting against email properties

  1. You can interact with the received mail and follow links as if it were a typical web page.

Click through the "... > Open Mailbox" menu to view your mail. This time click the "Open email" icon that appears when you hover over the email of choice.

Now you can interact with the rendered email as if it were any other webpage.

Open the rendered email and interact with it, including clicking through links.Open the rendered email and interact with it, including clicking through links.

Open the rendered email and interact with it, including clicking through links.

Verifying attachments


Maximum Attachment Size

Total email size must be less than 10 MiB.
Since this includes all email headers and metadata, the attachment limit will be under 10 MiB.

When viewing and interacting with the rendered email, you also have the ability to verify attachments to ensure that you're able to test every part of an email. Mabl Mailbox supports:

  • Inline Attachments (more common with Outlook)
  • Regular Attachments

Click on the link to the attachment to download it. Mabl will automatically download the attachment and let you assert on it normally, as you would with any other download.

The location of attachments within a mabl Mailbox rendered email.The location of attachments within a mabl Mailbox rendered email.

The location of attachments within a mabl Mailbox rendered email.

If the attachment is a PDF, and your subscription (i.e. Enterprise) includes PDF support, mabl will ask if you would like to test the PDF. From here you can test your PDF as you would any other.


Multiple attachment matches

If your email selector matches multiple attachments for the same Mailbox delivery address, mabl will open the most recently delivered matching email (e.g. latest email).


Attachment expiration

Attachment links will expire after 1 hour. If you keep an email validation tab open during manual training for over an hour, the links will not resolve. Simply replay the trained test to get refreshed links.

Exploring the Mailbox sandbox

Interested in learning more about mabl Mailbox? We recommend testing against the mabl sandbox app, which has a dedicated Mailbox section. To start trying it out, you can add an email address, subject, and body.

Mabl sandbox Mailbox exampleMabl sandbox Mailbox example

Mabl sandbox Mailbox example

Did this page help you?