Skip to content
couryo

Developer guideSending

SMTP

Couryo's SMTP relay at smtp.couryo.com, to send without changing code. Host, ports, username, password, reply codes and examples for Laravel, Node and Supabase.

View as Markdown

For apps, frameworks and tools that already send over SMTP, swapping the credentials is enough. Every message goes through the same path as the REST API: verified domain, trust levels, suppression, limits, timeline and webhooks.

Credentials#

Field Value
Host smtp.couryo.com
Port 587 (STARTTLS), 465 (implicit TLS) or 2525 (STARTTLS, when 587 is blocked)
Username couryo
Password your API key (ck_live_... or ck_test_...) with the send or admin scope
  • Login is only accepted after TLS (STARTTLS on 587 and 2525, or implicit TLS on 465), with TLS 1.2 or newer.
  • The sender (the From header) must be on a verified domain, as with the API. ck_test_ keys also work over SMTP and capture the email without delivering it.
  • The reply to DATA carries the message ID: 250 2.0.0 Ok: queued as msg_.... Look it up under Emails or with GET /v1/emails/{id}.

Laravel#

.env
MAIL_MAILER=smtp
MAIL_HOST=smtp.couryo.com
MAIL_PORT=587
MAIL_USERNAME=couryo
MAIL_PASSWORD=ck_live_...
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME="Example"

Node.js (Nodemailer)#

Node.js
import nodemailer from "nodemailer";

const transport = nodemailer.createTransport({
  host: "smtp.couryo.com",
  port: 587,
  secure: false, // STARTTLS
  requireTLS: true,
  auth: { user: "couryo", pass: process.env.COURYO_API_KEY },
});

const info = await transport.sendMail({
  from: "Example <hello@example.com>",
  to: "ana@example.com",
  subject: "Hello",
  text: "Sent by Couryo over SMTP.",
});
console.log(info.response); // 250 2.0.0 Ok: queued as msg_...

Supabase Auth and other tools#

In tools with a "custom SMTP" field (Supabase Auth, WordPress, n8n and the like), fill in host, port, username and password from the table above. For the Supabase confirmation and password emails, the fields ready to paste are on SMTP for Supabase; for apps built in Lovable or Bolt, with a ready prompt, on SMTP for Lovable and Bolt.

Options by header#

Header What it does
X-Couryo-Stream: marketing sends on the marketing stream (with one-click unsubscribe). Without it, the stream is transactional
X-Couryo-Tags: kind=order, store=downtown becomes the email tags (filters in the dashboard and in webhooks)
X-Couryo-On-Daily-Limit: queue at the daily limit, keeps the email for the turn of the day; reject refuses. Without it, the project setting applies (see Daily limit)
Idempotency-Key: order-1042 explicit idempotency key (see below)

Your own X-... headers (for example X-Order) stay in the final message. From, Message-ID, List-Unsubscribe and the authentication headers are always built by Couryo.

Idempotency#

SMTP clients try again when the connection drops in the middle of DATA. So that never becomes a duplicate email, Couryo uses the message's Message-ID (or the Idempotency-Key header, when present) as an idempotency key for 24 hours: the repeat gets 250 ... already queued as msg_... with the same ID and nothing is sent again. Refusals and errors are not kept: you can retry with the same Message-ID.

Reply codes#

Code When
250 2.0.0 accepted and queued (or captured, with ck_test_)
535 5.7.8 username other than couryo, invalid or revoked key, key without the send scope or IP outside the key's list
550 5.7.1 sender domain not verified, level 0 account sending outside the account, or every recipient suppressed
452 4.7.0 level, plan or spend limit, or sending paused. The message carries the reason and the numbers; try later
452 on RCPT TO more than 50 recipients in the same message
552 5.3.4 message over 30 MB
554 5.6.0 a message the API would refuse too (invalid field)
451 4.3.0 error on our side: nothing was sent, try again
454 too many failed logins from the same IP; wait 10 minutes

Messages follow the account language (Portuguese or English).

API or SMTP?#

API SMTP
Idempotency yes, with Idempotency-Key yes, by Message-ID or Idempotency-Key
Reply with the message id yes yes, in the reply to DATA
Batch of up to 100 in one call yes no
Saved templates yes no (send the final HTML)
Code changes small none

Both paths produce the same events, show up on the same timeline and call the same webhooks.