SMTP

Send through the Bytesms SMTP gateway with your API key as the password.

Anything that can send over SMTP — frameworks, CMSs, legacy apps — can send through Bytesms. SMTP messages go through the same pipeline as POST /v1/emails: the same verified-domain rules, quotas, suppression list, events, webhooks and logs.

Connection settings

SettingValue
Hostsmtp.bytesms.com
Port (implicit TLS)465 or 2465
Port (STARTTLS)587 or 2587
Usernamebytesms
PasswordAn API key (tp_live_…)
AuthenticationPLAIN or LOGIN

Encryption is mandatory: on the STARTTLS ports, AUTH before STARTTLS is refused, and MAIL FROMwithout authentication is refused. The API key's permission and domain scope apply, so a domain-scoped sending_access key is a good fit for SMTP. Your settings are also shown in Dashboard → Settings → SMTP.

Examples

import nodemailer from "nodemailer";

const transporter = nodemailer.createTransport({
  host: "smtp.bytesms.com",
  port: 465,
  secure: true, // implicit TLS
  auth: { user: "bytesms", pass: process.env.BYTESMS_API_KEY },
});

const info = await transporter.sendMail({
  from: "Acme <[email protected]>",
  to: "[email protected]",
  subject: "Hello over SMTP",
  html: "<p>It works!</p>",
});
console.log(info.response); // "250 OK: queued as <email id>"

How the message is read

  • Recipients come from the SMTP envelope (RCPT TO). Those listed in the To header become to, those in Cc become cc, every other envelope recipient is bcc. At least one recipient must appear in To; at most 50 recipients per message.
  • From and a non-empty Subject header are required; From must be on a verified domain. Reply-To is kept.
  • The message needs a text or HTML body. Other custom headers are not passed through.
  • Maximum message size: 10 MB.

Attachments are not supported

Messages with attachments are rejected with 554 5.6.1. Link to files instead.

SMTP replies

A successful DATA is answered with 250 OK: queued as <email id>. Errors map to SMTP codes:

ReplyCauseRetry?
535 5.7.8Wrong username or API key; suspended key.No
421 4.7.0Too many failed logins from your IP (10 per 15 minutes).Later
451 4.7.1Request rate limit exceeded.Yes
452 4.5.3Daily quota or warm-up limit reached.Tomorrow
552 5.3.4Monthly quota, overage cap or spend limit reached; message too large.No — change plan/limits
553 5.7.1From domain not verified, or not allowed for this key.No
550 5.7.1Workspace sending paused, under review or suspended; other policy blocks.No
550 5.6.0Invalid message (missing From/Subject/body, no To recipient, …).No
554 5.6.1Attachments.No
451 4.3.0Temporary server error.Yes

Prefer the REST APIwhen you need tags, templates, scheduling or idempotency — SMTP doesn't support them.