Skip to content

SMTP vs API for Sending Email

FeatureSMTP RelayEmail API (REST)
ProtocolSMTP (port 587 or 465)HTTPS (REST with JSON)
AuthenticationUsername and passwordAPI key in Authorization header
IntegrationChange SMTP config — no codeAdd HTTP calls to your app
SpeedConnection overhead per sessionSingle HTTP request per email
FeaturesBasic send onlyTemplates, scheduling, priority
Best forLegacy apps, CMS plugins, RailsModern apps, high-volume sends
DeliverabilitySame infrastructureSame infrastructure

Both SMTP and API deliver through the same email infrastructure with the same deliverability. The choice depends on your application architecture and integration preferences.

SMTP relay is the right choice when:

  • Your application already has SMTP configuration (Rails, Django, Laravel, WordPress)
  • You want to switch email providers without changing application code
  • You need to integrate with legacy systems that only support SMTP
  • Your CMS or framework has built-in SMTP support

With SMTP, you change configuration settings — no code changes required. RelayPost provides SMTP relay on port 587 (STARTTLS) and 465 (TLS).

A REST API is the right choice when:

  • You are building a new application and want full control over email sending
  • You need advanced features like templates, scheduling, or priority levels
  • You send high volumes and want the efficiency of single HTTP requests
  • You want structured JSON responses with delivery status and message IDs

The API gives you programmatic control over every aspect of email sending, including template rendering, metadata, and scheduling.

const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({
host: "smtp.relaypost.dev",
port: 587,
secure: false,
auth: { user: "smtp_username", pass: "smtp_password" },
});
await transporter.sendMail({
subject: "Hello",
html: "<p>Sent via SMTP relay</p>",
});
const response = await fetch("https://api.relaypost.dev/v1/emails/send", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer YOUR_API_KEY",
},
body: JSON.stringify({
from: { email: "[email protected]", name: "Your App" },
to: [{ email: "[email protected]" }],
subject: "Hello",
html: "<p>Sent via REST API</p>",
}),
});

The REST API is generally faster for individual sends because each email is a single HTTP request. SMTP requires establishing a connection, performing a TLS handshake, and exchanging multiple commands per session. For batch sending, SMTP can reuse a single connection for multiple messages, which reduces overhead.

Can I use both SMTP and API with the same provider?

Section titled “Can I use both SMTP and API with the same provider?”

Yes. RelayPost supports both SMTP relay and REST API on the same account. Both methods deliver through the same infrastructure with the same deliverability. You can use SMTP for your legacy applications and the API for new integrations.

Does SMTP or API have better deliverability?

Section titled “Does SMTP or API have better deliverability?”

Deliverability is identical. Both SMTP and API route through the same sending infrastructure, IP addresses, and DKIM signing. The delivery method does not affect inbox placement — authentication (SPF, DKIM, DMARC) and sender reputation are what matter.