Quick Start Guide

Get up and running with Mailhooks in just a few minutes. This guide will walk you through setting up your first domain and receiving emails.

Step 1

Create Your Account

If you haven't already, sign up for a Mailhooks account. You'll get a free tier that includes:

1 domain

Custom email domain

100 emails/month

Receive up to 100 emails

100 API req/min

Generous rate limits

Step 2

Add Your Domain

After logging in, navigate to the Domains section in your dashboard:

  1. 1Click "Add Domain"
  2. 2Enter your domain name (e.g., mail.yourdomain.com)
  3. 3Copy the DNS records provided
  4. 4Add these records to your domain's DNS settings
  5. 5Wait for verification (usually takes 5-30 minutes)
Step 3

Create an API Key

  1. 1Go to API Keys in your dashboard
  2. 2Click "Create API Key"
  3. 3Give it a descriptive name like "Production App"
  4. 4Copy and securely store the generated key
Step 4

Set Up a Webhook (Recommended)

Webhooks allow you to receive real-time notifications when emails arrive:

  1. 1Go to Webhooks in your dashboard
  2. 2Click "Create Webhook"
  3. 3Enter your endpoint URL (e.g., https://your-app.com/api/webhooks/mailhooks)
  4. 4Select the "email.received" event
  5. 5Save your webhook

Example Webhook Handler (Node.js/Express)

const express = require('express');
const app = express();

app.use(express.json());

app.post('/api/webhooks/mailhooks', async (req, res) => {
  const { event, data } = req.body;
  
  if (event === 'email.received') {
    console.log('New email received!');
    console.log('From:', data.from);
    console.log('Subject:', data.subject);
    
    // Process the email
    await processEmail(data);
  }
  
  res.status(200).send('OK');
});

async function processEmail(email) {
  // Your email processing logic here
  // e.g., save to database, trigger notifications, etc.
}
Step 5

Send a Test Email

Once your domain is verified, send a test email to any address at your domain:

Example addresses:

If you set up a webhook, you'll see the request hit your endpoint immediately. You can also retrieve the email via the API:

Using cURL

curl -H "x-api-key: mh_your_api_key_here" \
     http://localhost:3000/api/v1/emails

Using TypeScript SDK

import { Mailhooks } from '@mailhooks/sdk';

const mailhooks = new Mailhooks({
  apiKey: 'mh_your_api_key_here'
});

// Get all emails
const emails = await mailhooks.emails.list();

// Get the latest email
const latestEmail = emails.data[0];
console.log('Latest email:', latestEmail.subject);

Next Steps

© 2025 Mailhooks. All rights reserved.