Send and receive emails in Python from MailSlurp test email accounts.

Add dependencies

To use test email accounts in PyTests first sign up for a free MailSlurp account.

Then install the MailSlurp python library and PyTest with :

Or add them to your :

Configure email client

Next add the MailSlurp client and configure it with your MailSlurp API Key.

Common usage

Create test email accounts

We can use MailSlurp to create test inboxes. These have real email addresses.

Send emails

You can send emails in Python using MailSlurp too:

Receive emails and extract contents

To receive emails in PyTest use MailSlurp's waitFor controllers to receive emails directly in code. This test demonstrates how to send an email then receive its content. In this way we can read emails in Python tests.

Next steps

MailSlurp is free for personal use. So check out www.mailslurp.com for more.