All use cases
INV

SaaS Invitation Flows

Verify team invitation emails and magic links

Automatically E2E test invitation-based flows in your SaaS app: team member invitations, magic link authentication, shared links, and more. Verify email deliverability, link validity, and permission accuracy.

Why MailBrew for this use case

01

Full invitation flow automation

Auto-test the complete flow: send invite email, receive, click link, create account.

02

Magic link verification

Extract magic links from emails and verify validity, expiration, and single-use enforcement.

03

Permission testing

Verify that invited users receive the correct permissions (admin/member/viewer).

04

Parallel multi-invite testing

Test multiple invitation scenarios simultaneously with independent addresses per test.

Sample code

Ruby (RSpec)

Ruby (RSpec)
# RSpec + MailBrew: SaaS invitation flow test
require 'mailbrew'

client = MailBrew::Client.new('mb_your_key_here')

RSpec.describe 'Team invitation flow' do
  it 'invites a member who joins the team' do
    addr = client.addresses.create(ttl: 600)

    post '/api/team/invite', { email: addr.address, role: 'member' }

    emails = client.addresses.emails(addr.address)
    expect(emails.first.subject).to include('Invitation')

    invite_url = emails.first.html_body.match(/href="([^"]+invite[^"]+)"/)[1]
    get invite_url
    expect(response).to have_http_status(:ok)
  end
end

Ready to try this use case?

Get started with the free plan today. No credit card required.

Create free account