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
| Setting | Value |
|---|---|
| Host | smtp.bytesms.com |
| Port (implicit TLS) | 465 or 2465 |
| Port (STARTTLS) | 587 or 2587 |
| Username | bytesms |
| Password | An API key (tp_live_…) |
| Authentication | PLAIN 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 theToheader becometo, those inCcbecomecc, every other envelope recipient isbcc. At least one recipient must appear inTo; at most 50 recipients per message. Fromand a non-emptySubjectheader are required;Frommust be on a verified domain.Reply-Tois 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
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:
| Reply | Cause | Retry? |
|---|---|---|
535 5.7.8 | Wrong username or API key; suspended key. | No |
421 4.7.0 | Too many failed logins from your IP (10 per 15 minutes). | Later |
451 4.7.1 | Request rate limit exceeded. | Yes |
452 4.5.3 | Daily quota or warm-up limit reached. | Tomorrow |
552 5.3.4 | Monthly quota, overage cap or spend limit reached; message too large. | No — change plan/limits |
553 5.7.1 | From domain not verified, or not allowed for this key. | No |
550 5.7.1 | Workspace sending paused, under review or suspended; other policy blocks. | No |
550 5.6.0 | Invalid message (missing From/Subject/body, no To recipient, …). | No |
554 5.6.1 | Attachments. | No |
451 4.3.0 | Temporary server error. | Yes |
Prefer the REST APIwhen you need tags, templates, scheduling or idempotency — SMTP doesn't support them.
