Sending

SMTP relay

Send transactional email from any framework or tool over SMTP, with a username and password per EmailMarketer.io sending domain.

Use SMTP when your framework, CMS or a third-party tool already sends mail and you only want to change the server settings. Messages sent over SMTP count against the same monthly allowance as everything else.

Before you start

  • Verify the sending domain in the app.
  • SMTP relay needs an account that is approved for transactional sending. Contact us if SMTP credentials are not available on your account.

Get credentials

In the app, open Transactional, pick the domain and open the SMTP tab. Create a credential. The app shows:

Setting Value
Host Shown on the SMTP tab
Ports Shown on the SMTP tab
Username Created per credential
Password Shown once when you create the credential. Reset it if you lose it

Use the host and ports shown in the app. Each credential belongs to one sending domain. Send only from addresses on that domain.

Encryption

Use a port that supports STARTTLS, and turn on STARTTLS (sometimes called “TLS” or “explicit TLS”) in your client. On ports that require TLS, the server refuses AUTH before STARTTLS with 530 5.7.0.

Example: Node.js with Nodemailer

import nodemailer from 'nodemailer';

const transport = nodemailer.createTransport({
  host: process.env.EM_SMTP_HOST,   // from the SMTP tab
  port: 587,
  secure: false,                    // STARTTLS after connect
  requireTLS: true,
  auth: { user: process.env.EM_SMTP_USER, pass: process.env.EM_SMTP_PASS },
});

await transport.sendMail({
  from: 'Acme <no-reply@acme.com>',
  to: 'jane@example.com',
  subject: 'Your receipt',
  text: 'Thanks for your order.',
});

Example: Python

import os, smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["From"] = "Acme <no-reply@acme.com>"
msg["To"] = "jane@example.com"
msg["Subject"] = "Your receipt"
msg.set_content("Thanks for your order.")

with smtplib.SMTP(os.environ["EM_SMTP_HOST"], 587) as s:
    s.starttls()
    s.login(os.environ["EM_SMTP_USER"], os.environ["EM_SMTP_PASS"])
    s.send_message(msg)

Suppressed recipients

Over SMTP, suppressed recipients in To, CC and BCC are removed from the message without an error. The other recipients still get it. Use the HTTP API if your app needs to know when an address is suppressed. The API refuses the send with HTTP 409.

Rate limits

When an account sends faster than its limit, the server answers 500 5.0.0 EMAIL SEND RATE LIMIT REACHED. Retry later.

Manage credentials with the API

The account API has commands to create, list, delete and reset SMTP credentials. See Transactional (domains and keys).