Warming up a new email backend

A new IP address has no sending history, so mailbox providers like Gmail and Outlook accept only a small number of emails from it at first. IP warming is the practice of raising the volume step by step until the IP carries your full traffic.

This guide shows how to warm up a new email backend in SendStreak while your current email backend keeps sending everything else. You need no change in your application.

Typical cases:

  • You move from a paid email provider such as AWS SES or Postmark to a self-hosted SMTP server.
  • You move to a dedicated IP at the same email provider.
  • You add a second email provider and want to build its reputation before you rely on it.

How it works

When a template has no preferred email backend, SendStreak picks one of the email backends of the workspace at random for each email. An email backend that has reached one of its send limits is passed over.

With two email backends, this gives you a warm-up split:

  • The new email backend has low send limits. It takes about half of the emails until a limit is reached.
  • The current email backend has no send limits. It takes the other half, and then everything over the limit.

No email waits and no email is lost, because the current email backend always has room.

Example: your workspace sends 2,000 emails a day, and the new email backend has a limit of 100 emails per day. The new email backend sends 100 emails. The current one sends 1,900.

Before you start

  • Your current email backend works and has no send limits, or limits far above your volume.
  • The new SMTP server can send for your domain. Its IP has a reverse DNS (PTR) record, and your domain has SPF, DKIM and DMARC records that cover the new server. Both email backends can sign for the same domain at the same time, because each one uses its own DKIM selector.
  • You know your daily volume. The Overview page of your workspace shows it.

Step 1: Add the new email backend with low limits

  1. Go to Settings → Email servers and click Add email server.
  2. Pick your email provider. For a self-hosted SMTP server, pick Other/Generic SMTP and enter the host, port and credentials.
  3. Set the default sender address to the same address that your current email backend uses.
  4. In the Send limits section, set Emails per day and Emails per hour. A common start is 50 emails per day and 5 emails per hour.
  5. Click Save. SendStreak opens a real SMTP session to check the connection.

SendStreak send limits of an email backend

Set both limits. The new email backend takes about half of your emails from the start of each day (00:00 UTC), so a daily limit alone is used up in the first hours. The hourly limit spreads the emails over the day. An hourly limit of one tenth of the daily limit spreads them over at least 10 hours.

The limits take effect on the next email.

Step 2: Choose which emails take part

Only an email whose template has no preferred email backend can go to the new email backend.

  • To keep a template away from the new IP, open the template, turn on Override preferred email server and select your current email backend.
  • Do not select the new email backend as the preferred one during the warm-up. Such an email never moves to the other email backend. It waits for the next free hour or day, and a transactional email waits only 5 minutes before it gets the status Send limit.

Mailbox providers build reputation from how recipients react. So let the emails that people expect and open go through the new IP first: password resets, email verifications, receipts. Pin digests and announcements to the current email backend for the first weeks.

Step 3: Raise the limits

Raise the limits in small steps, once a day at most. An increase of 25% a day doubles the volume about every three days:

Day Emails per day Emails per hour
1 50 5
4 99 10
7 194 20
10 380 38
14 929 93
18 2,272 228
21 4,438 444
25 10,837 1,084
28 21,168 2,117

This table is an example. The IP warm-up calculator makes the table for your own volume. Hold the limits where they are, or lower them, when the signals in Step 4 turn bad.

You can change the limits by hand in the form, or with the REST API.

Raise the limits with the API

Update a mail server takes sendLimits with perHour, perDay and perMonth. The update takes the complete email backend, and the API never returns the SMTP password, so the script sends the password again.

This Node.js script (version 18 or later, no dependencies) raises the daily limit by 25% on each run:

// warmup-ramp.mjs
// Raises the send limits of one SendStreak email backend by one step.
// Run it once a day from cron. To hold the ramp, skip the run.
const {
    SENDSTREAK_TOKEN,
    SENDSTREAK_ACCOUNT_ID,
    SENDSTREAK_MAIL_SERVER_ID,
    SMTP_PASSWORD
} = process.env;

const START_PER_DAY = Number(process.env.START_PER_DAY ?? 50);
const TARGET_PER_DAY = Number(process.env.TARGET_PER_DAY ?? 20000);
const GROWTH = Number(process.env.GROWTH ?? 1.25);
const API = 'https://api.sendstreak.com';

const url = `${API}/v2/accounts/${SENDSTREAK_ACCOUNT_ID}/mail-servers/${SENDSTREAK_MAIL_SERVER_ID}`;
const headers = {
    Authorization: `Bearer ${SENDSTREAK_TOKEN}`,
    'Content-Type': 'application/json'
};

async function call(method, body) {
    const res = await fetch(url, { method, headers, body: body && JSON.stringify(body) });

    if (!res.ok) {
        throw new Error(`${method} ${url} returned ${res.status}: ${await res.text()}`);
    }

    return res.json();
}

const current = await call('GET');
const currentPerDay = current.sendLimits?.perDay;

// The first run sets the start value. Every later run raises the stored value.
const perDay = Math.min(
    TARGET_PER_DAY,
    currentPerDay ? Math.ceil(currentPerDay * GROWTH) : START_PER_DAY
);

// A tenth of the day in one hour spreads the emails over at least 10 hours.
const perHour = Math.max(1, Math.ceil(perDay / 10));

// The update takes the complete email backend. The API masks the password on
// every read, so the script sends it again.
await call('PATCH', {
    serviceType: current.serviceType,
    host: current.host,
    port: current.port,
    secure: current.secure,
    requireTLS: current.requireTLS,
    allowInsecureTLS: current.allowInsecureTLS ?? false,
    user: current.user,
    password: SMTP_PASSWORD,
    defaultFromEmail: current.defaultFromEmail,
    defaultFromName: current.defaultFromName,
    sendLimits: { perHour, perDay }
});

console.log(`${new Date().toISOString()} send limits: ${perHour} per hour, ${perDay} per day`);

if (perDay === TARGET_PER_DAY) {
    console.log('Target reached. Remove this cron job.');
}

Run it a few minutes after midnight UTC, so that each new limit covers a whole day:

5 0 * * * cd /opt/warmup && node --env-file=.env warmup-ramp.mjs >> warmup.log 2>&1

The .env file holds the four values. See Authentication for the token and the account ID. The ID of the email backend is the _id in the response of List mail servers.

SENDSTREAK_TOKEN=sst_pat_YOUR_TOKEN
SENDSTREAK_ACCOUNT_ID=YOUR_ACCOUNT_ID
SENDSTREAK_MAIL_SERVER_ID=YOUR_MAIL_SERVER_ID
SMTP_PASSWORD=YOUR_SMTP_PASSWORD

The script does not look at your delivery results. To hold the ramp, comment out the cron line. The limits then stay where they are.

Step 4: Watch the signals

SendStreak records the result of the SMTP session with your email backend. A self-hosted SMTP server accepts the email first and delivers it later, so a rejection by Gmail or Outlook appears in the log of your SMTP server, not in SendStreak.

Check these every day before you raise the limits:

  • The mail log of the new server. With Postfix, look for status=deferred and status=bounced lines and read the reply of the mailbox provider. A 4xx reply that mentions rate or reputation means the step was too large. See SMTP status codes.
  • The spam rate that the mailbox providers report for your domain, for example in Google Postmaster Tools.
  • The Overview page in SendStreak, for failed emails. These are emails that the new email backend itself refused.

If deferrals or the spam rate go up, keep the limits for a few days or lower them. Then continue.

Step 5: Go past half of your traffic

While the current email backend has no send limits, the new one never gets more than about half of your emails. To move more traffic to it, turn the setup around:

  1. Remove the send limits of the new email backend. Clear all three fields and save.
  2. Set Emails per day and Emails per hour on the current email backend to the volume that it still has to carry.
  3. Lower these limits step by step.

Example: with 2,000 emails a day and a limit of 500 emails per day on the current email backend, the new one sends 1,500.

Still no email waits, because now the new email backend has no limit.

Step 6: Finish

When the new email backend carries nearly all of your traffic without problems:

  1. Check that no template has the old email backend as its preferred one.
  2. Delete the old email backend, or keep it with a low limit as a second route.

If you delete it, SendStreak removes it from every template that preferred it.

What this method does not do

  • The limits do not rise by themselves. You raise them by hand or with the API.
  • There is no failover on errors. SendStreak passes over an email backend that is at a send limit. It does not move an email to the other email backend when the first one returns an error.
  • You do not pick the recipients. The split is random. You control only which templates take part (Step 2).
  • Periods are calendar periods in UTC. A day starts at 00:00 UTC, and an hour starts at minute 0.