Skip to content
Facteur
/ Comparison

Facteur and Mailtrap

Mailtrap offers a fake SMTP server, the Email Sandbox. Here is what it publishes, then what Facteur does.

Sources

What Mailtrap publishes

Each line is something Mailtrap publishes. It carries the address of the page where we read it and the date we read it. What we could not check is not here. These pages change: read the source again before you decide.

  1. 01

    Mailtrap's Email Sandbox describes itself as a fake SMTP server that traps all emails sent from your application. Each sandbox has its own SMTP credentials.

    https://docs.mailtrap.io/email-sandbox/overview ·

  2. 02

    Mailtrap publishes SDKs for Node.js and TypeScript, PHP, Python, Ruby, Java, Go and .NET.

    https://docs.mailtrap.io/email-sandbox/overview ·

  3. 03

    The sandbox shows HTML and text previews of emails, validates the HTML and scores spam risk with SpamAssassin.

    https://docs.mailtrap.io/email-sandbox/overview ·

  4. 04

    The free Email Sandbox plan shows $0 per month, 50 test emails, 1 sandbox and 1 user.

    https://mailtrap.io/pricing/ ·

  5. 05

    Three paid Email Sandbox plans are shown with annual billing: Basic at $14 per month (500 test emails, 1 sandbox, 3 users), Team at $34 (5,000 emails, 5 sandboxes, 5 users) and Business at $99 (50,000 emails, 50 sandboxes, 50 users).

    https://mailtrap.io/pricing/ ·

  6. 06

    The official example of the mailtrap Node client builds new MailtrapClient({ token, testInboxId, accountId }), lists the messages of a test inbox with client.testing.messages.get(inboxId), then reads a message with getTextMessage(inboxId, messageId) or getHtmlMessage(inboxId, messageId).

    https://github.com/mailtrap/mailtrap-nodejs/blob/main/examples/testing/messages.ts ·

Translating your tests

The same test, with one then the other

Mailtrap's client lists the messages of a test inbox, then asks for the text of one. At Facteur, a single call waits for the matching message and returns it with its code already extracted.

Before, with Mailtrap JavaScript
const { MailtrapClient } = require('mailtrap');
const client = new MailtrapClient({ token, testInboxId: inboxId, accountId });

// The list of the test inbox's messages, then the text of the first one.
const messages = await client.testing.messages.get(inboxId);
const text = await client.testing.messages.getTextMessage(inboxId, messages[0].id);

// The code is still to be found in text.
Every call of Mailtrap shown here comes from its documentation: the Sources section gives the page and the date it was read.
After, with Facteur TypeScript
// No Facteur package to install: one HTTP call that waits.
const search = new URLSearchParams({
  inbox: 'j3k9x2mq',
  sentTo: address,
  wait: '30000',
});

const response = await fetch('https://api.facteur.eu/v1/messages?' + search, {
  headers: { authorization: 'Bearer ' + process.env.FACTEUR_API_KEY },
});
const { messages } = await response.json();

// The code is already extracted, in a field of its own.
const code = messages[0].otp;
Facteur publishes no library yet: the test calls the API over HTTP. The developers' portal plays this call against the service.
The migration, step by step

Four steps, both services side by side

  1. Step 01

    Create an account and an inbox

    Each inbox has its own domain, and any address ending with it is accepted from the first message. There is nothing else to set up.

  2. Step 02

    Point the sends at the inbox

    Where Mailtrap captures your application's SMTP traffic, your scenarios now write to an address of the inbox: the message follows the real sending path, the one a user will see.

  3. Step 03

    Replace the calls in the tests

    Listing the messages and reading the text become a single search, which waits for the message and returns the body, the links and the code already extracted.

  4. Step 04

    Run the suite, then cancel

    Keep both accounts until the suite is green: there is no data to export and no DNS to switch.

The switch, in short

What changes, row by row

Each cell about Mailtrap links to the sentence of the sources it comes from. A row that no source lets us write is not in the table.

Topic Facteur Mailtrap
Reception Your application writes to an address of the inbox, as it would write to a person. A fake SMTP server intercepts the emails your application sends. source
Waiting for a message The search waits for the message on the server side, five minutes at most. The official example lists the inbox's messages, then reads the text of one. source
Rendering and spam No rendering preview, no HTML validation, no spam score. HTML and text previews, HTML validation, SpamAssassin spam score. source
Libraries No library published: an HTTP call, from any language. Kits for Node.js and TypeScript, PHP, Python, Ruby, Java, Go and .NET. source
Number of inboxes The number of inboxes depends on the plan: the Pricing page gives it. The number of sandboxes depends on the plan. source
Facteur

What Facteur does

These lines describe Facteur as its product pages and help centre give it.

01

One address per test

Everything before the at sign is free. Two tests writing to inscription+run-42 and inscription+run-43 each get their own message, in the same inbox.

02

Wait for the message in one request

The search accepts a wait of five minutes at most. If nothing arrives, it answers an empty list, not an error.

03

The code, already extracted

The otp field holds the most likely one-time code. When nothing announces it, Facteur leaves it empty rather than guess.

04

Reading costs nothing

Only a received, kept message counts against your plan. A test that receives 3 emails and reads them 40 times uses 3.

05

Deleted when its time is up

Each message is deleted when your plan's duration has passed, with its raw file and attachments.

06

Hosted at OVHcloud

The application and its database are hosted at OVHcloud, and billing is in euros. The data centre is in France.

07

SMS are not received yet

The connection to the carrier that delivers SMS is not in service. An assigned number receives no real SMS today.

Choosing

Frequently asked questions

When to look at Mailtrap?

Mailtrap publishes HTML previews, HTML validation and a spam score. Facteur's documentation describes none of these. If your test checks how an email renders more than what it contains, look at Mailtrap.

How much work is the migration from Mailtrap?

Mechanical work: replace the client, write to the inbox's addresses instead of the SMTP capture, drop the two-step read. There is no data to move and no DNS to switch, and the migration goes file by file.

What happens to the messages already received at Mailtrap?

They stay at Mailtrap. They are test data: they come back on the next run of your suite, there is nothing to export.

Where are Facteur's prices?

On the Pricing page, which reads Facteur's grid. No Facteur price is written here.

Try Facteur without an account

The trial receives a test email, with no sign-up. Prices are on the Pricing page.