TempMail

Disposable Email for Developers: Testing Email Flows

Disposable Email for Developers: Testing Email Flows

How developers and QA engineers can use temporary email to automate email testing without managing real mailboxes.

The Problem with Email Testing

Testing email functionality is one of the most annoying parts of software development:

  • Creating real email accounts for testing is tedious
  • Gmail blocks automated access
  • Shared test inboxes get cluttered
  • Email delivery is unpredictable in development

The Solution: Temp Mail API

TempMail provides a simple REST API that lets you:

  • Use any email address instantly (no account creation)
  • Fetch received emails via HTTP
  • Delete emails programmatically
  • Paginate through results

Integration with Testing Frameworks

Selenium / Playwright Example

const { test, expect } = require('@playwright/test');

test('user registration sends confirmation email', async ({ page }) => {
  const testEmail = `test${Date.now()}@mailmomy.com`;

  // Register on your app
  await page.goto('https://yourapp.com/register');
  await page.fill('#email', testEmail);
  await page.fill('#password', 'Test123!');
  await page.click('button[type=submit]');

  // Wait for confirmation email
  let email = null;
  for (let i = 0; i < 15; i++) {
    const res = await fetch(`https://mailmomy.com/api/mail/messages?to=${testEmail}`);
    const data = await res.json();
    if (data.emails.length > 0) { email = data.emails[0]; break; }
    await new Promise(r => setTimeout(r, 2000));
  }

  expect(email).not.toBeNull();
  expect(email.subject).toContain('Confirm');
});

CI/CD Pipeline

Temp mail works great in CI/CD because:

  • No credentials to manage
  • No mailbox setup
  • No rate limits for reading
  • Emails auto-cleanup

API Endpoints for Testing

| Endpoint | Use Case | |---|---| | GET /api/mail/messages?to=... | Check for received emails | | DELETE /api/mail/delete?to=... | Clean up after tests | | DELETE /api/mail/delete?id=... | Delete specific test email | | GET /api/domains/active | Get available domains |

Full documentation: API Docs

← Back to Blog