Skip to content

Quickstart

Send one email through MailPush, then read back what happened to it.

  • A domain whose DNS records you can edit.
  • cURL, or Node.js 22 or later for the SDK.

Sign up at mailpush.app/signup with an email address and a password, then open the confirmation email.

In the dashboard, open Domaines (domains), add the domain you send from, and publish the two DNS records shown. The page checks them every 20 seconds and switches to Vérifié when they resolve. See Verify a domain for the records.

Open Clés API (API keys) and create a production key. It starts with mp_live_ and is shown once, so store it in an environment variable now.

Terminal window
export MAILPUSH_API_KEY="mp_live_..."

Replace example.com with your verified domain.

With cURL:

Terminal window
curl https://api.mailpush.app/v1/emails \
-H "Authorization: Bearer $MAILPUSH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "Acme <hello@example.com>",
"to": "customer@example.org",
"subject": "Your order is ready",
"html": "<p>Hello, your order is waiting for you.</p>"
}'

With the Node.js SDK, after npm install mailpush:

import { MailPush } from "mailpush";
const mailpush = new MailPush(process.env.MAILPUSH_API_KEY);
const { id } = await mailpush.emails.send({
from: "Acme <hello@example.com>",
to: "customer@example.org",
subject: "Your order is ready",
html: "<p>Hello, your order is waiting for you.</p>",
});

The response is the id of the email.

{ "id": "em_4b9b3c1f0a2e7d5c9e8f1a2b" }

Ask for the email with the same key. Each recipient has its own status and the last answer of its mail server.

Terminal window
curl https://api.mailpush.app/v1/emails/em_4b9b3c1f0a2e7d5c9e8f1a2b \
-H "Authorization: Bearer $MAILPUSH_API_KEY"
const email = await mailpush.emails.get(id);
console.log(email.recipients);

The same information is in the dashboard, under Emails, with a preview of the content.