Developer Documentation

SMTP Submission

Emailit-style SMTP submission via smtp-api.mailapi.tech with AUTH PLAIN/LOGIN.

Mails.now supports sending transactional emails through SMTP using your API key as the SMTP password (Emailit-style).

Credentials

Use these values in your SMTP client:

  • Host: smtp-api.mailapi.tech
  • Port: 587 (recommended, STARTTLS) or 465 (implicit TLS)
  • Username: mails.now (fixed)
  • Password: your Mails.now API key

The From address must match one of your provisioned mailboxes on the same tenant.

SMTP submission sends the MIME subject and body you provide. It does not load dashboard Email Templates. For template IDs and {{variables}}, use POST /api/v1/transactional/send instead.

SMTP AUTH behavior

The gateway authenticates with SMTP AUTH PLAIN/LOGIN using:

  • fixed username mails.now
  • SMTP password = your 32-character API key

After authentication, submissions are forwarded into the same outbound delivery pipeline used by the REST API.

Compatibility matrix

Runtime Use SMTP gateway Notes
Laravel / Symfony / PHPMailer Yes Standard MAIL_* / DSN
Node / Express / Next.js (Node runtime) Yes nodemailer / similar
Python / Django Yes smtplib / django-smtp
AWS Lambda Yes Needs outbound TCP (NAT/VPC); prefer 587
Vercel serverless (Node) Usually yes Confirm provider allows egress to 587/465
Cloudflare Workers No TCP SMTP Use POST /api/v1/transactional/send with the same API key

Example (Laravel)

Example

MAIL_MAILER=smtp
MAIL_HOST=smtp-api.mailapi.tech
MAIL_PORT=587
MAIL_USERNAME=mails.now
MAIL_PASSWORD=<YOUR_API_KEY>
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="you@your-verified-domain.com"
MAIL_FROM_NAME="${APP_NAME}"

Example (Node.js / nodemailer)

Example

import nodemailer from 'nodemailer';

const transporter = nodemailer.createTransport({
  host: 'smtp-api.mailapi.tech',
  port: 587,
  secure: false, // STARTTLS
  auth: {
    user: 'mails.now',
    pass: process.env.MAILS_NOW_API_KEY,
  },
});

await transporter.sendMail({
  from: 'noreply@yourdomain.com',
  to: 'customer@example.com',
  subject: 'Hello',
  html: '<p>Hi there</p>',
});

Example (Python / smtplib)

Example

import smtplib
from email.message import EmailMessage
import os

msg = EmailMessage()
msg["From"] = "noreply@yourdomain.com"
msg["To"] = "customer@example.com"
msg["Subject"] = "Hello"
msg.set_content("Hi there")
msg.add_alternative("<p>Hi there</p>", subtype="html")

with smtplib.SMTP("smtp-api.mailapi.tech", 587) as smtp:
    smtp.starttls()
    smtp.login("mails.now", os.environ["MAILS_NOW_API_KEY"])
    smtp.send_message(msg)

Example (PHPMailer)

Example

use PHPMailer\PHPMailer\PHPMailer;

$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp-api.mailapi.tech';
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Username = 'mails.now';
$mail->Password = getenv('MAILS_NOW_API_KEY');
$mail->setFrom('noreply@yourdomain.com');
$mail->addAddress('customer@example.com');
$mail->Subject = 'Hello';
$mail->Body = '<p>Hi there</p>';
$mail->isHTML(true);
$mail->send();

Serverless / platform notes

  • AWS Lambda / Vercel Functions / typical Node runtimes: generally work as long as outbound TCP to port 587/465 is allowed.
  • Cloudflare Workers: do not support direct TCP SMTP in most setups. For Workers, use the HTTP transactional endpoint instead: POST /api/v1/transactional/send with transactional_message_id, to, and from (do not send subject or message on that REST call).

Gateway DNS/TLS (staging + production)

  1. Point smtp-api.mailapi.tech to your running SMTP gateway (A/AAAA or CNAME).
  2. Provide a TLS certificate for smtp-api.mailapi.tech to the gateway service.
  3. Run a smoke test using a known mailbox From address on your tenant:

Example

# Requires: the API key and a mailbox you own (From address)
swaks --server smtp-api.mailapi.tech --port 587 --tls \
  --auth LOGIN --auth-user mails.now --auth-password "$MAILS_NOW_API_KEY" \
  --from noreply@yourdomain.com --to customer@example.com \
  --header "X-Request-Id: smoke-1" \
  --data '<p>Hello from SMTP gateway</p>'