API reference

SMTP relay

Send transactional emails from any tool that speaks SMTP, with an API key as the password

Most tools can send through an SMTP server even when they can't call an API: Supabase Auth, Ghost, WordPress, Discourse, Keycloak, n8n, Django, Rails, Laravel. Point them at Kula and their emails leave from your verified domain, as transactional emails of your space.

Connection settings

Hostsmtp.kulamail.com
Port587 or 2587 with STARTTLS, 465 or 2465 with TLS
Usernamekula with a space key, or the space id with an account key
PasswordAn API key of the space
AuthenticationPLAIN or LOGIN
  • TLS is required, version 1.2 at least. On 587 and 2587, the client must send STARTTLS before logging in.
  • Use 2587 or 2465 when your host blocks the usual SMTP ports, as DigitalOcean and some platforms do.
  • Port 25 is not open.

Settings › SMTP shows these settings for your space.

Authentication

Create a key in Settings › API keys. A key with sending access is enough, and safer to paste into a tool. API keys.

KeyUsername
Space key (ml_…)kula
Account keyThe id of the space to send from

A revoked key stops working within 60 seconds. After 10 failed logins in 10 minutes, an IP is refused for 15 minutes.

What Kula does with an email

Each email is sent as if your tool called POST /v1/emails/batch with your key: same checks, same rate limits, same suppression list.

EmailBecomes
Envelope recipients (RCPT TO)One email per recipient, Bcc included
FromThe sender. It must use a verified domain of the space. Without it, the default sender of the space
Reply-ToWhere replies go (the first address)
SubjectThe subject
text/html and text/plain partsThe content, sent as given. Without a plain-text part, Kula derives one
In-Reply-To, References, X-* headersKept, 20 at most, except X-SES-* and X-Mailler-*, dropped
X-Kula-Tag-<name>: <value> headersTags
X-Kula-Track headerTracking

The envelope sender (MAIL FROM) is ignored: bounces go to Kula, through the MAIL FROM domain of your space.

One email per recipient

Each recipient gets their own copy, with only their address in To. An email to three people in To and Cc becomes three separate emails, and none of them shows the other recipients. Each one has its own status, activity and webhooks, and counts as one email.

Tags

Add headers named X-Kula-Tag-<name> to tag the email, 20 at most. Names are lowercased.

X-Kula-Tag-User-Id: usr_1042
X-Kula-Tag-Kind: password-reset

They come back as {"user-id": "usr_1042", "kind": "password-reset"} in the activity and every webhook about the email, and filter the stats.

Tracking

Emails are not tracked unless you ask. Add an X-Kula-Track header with opens, clicks or both:

X-Kula-Track: opens, clicks

Values are comma separated and case-insensitive; unknown values are ignored. Like X-Kula-Tag-*, the header is not sent with the email.

Don't track clicks on sign-in, password reset or other single-use links: they would go through Kula's redirect server and be stored by Kula.

Duplicates

If your tool loses the connection after sending an email and sends it again, Kula recognizes it by its Message-ID and does not send it twice. Most tools set a Message-ID; without one, a resent email is sent again.

Limits

Limit
Email size10 MB
HTML and text content1 MB each
Recipients per email50. Clients send the rest in another transaction
Connections per IP20 at once
Idle connectionClosed after 2 minutes

Each email counts as one request in the rate limits of the key.

Response codes

CodeMeaningWhat to do
250Queued. The answer gives the email idNothing
530Login before STARTTLSEnable STARTTLS, or use port 465
535Wrong username or key, or account suspendedCheck the username (kula) and the key
554 5.6.0Attachment, or no readable contentSend without attachments
554 5.7.1Refused: sender outside a verified domain, missing subject, content too large, revoked keyRead the message, fix and resend
554 5.7.0Monthly limit of your plan reachedBilling
451 4.7.1Rate limit, or the daily SMTP limit before approvalYour tool retries later
451 4.3.0Temporary error on our sideYour tool retries later
452Over 50 recipientsYour tool sends the rest separately
421Too many connections, or too many failed loginsWait and reconnect

When some recipients of an email are refused, the answer is the first refusal. Resend the whole email: recipients already accepted are not sent twice.

Test mode

Use a key of a test space (ml_test_…): nothing is delivered, every email appears in Activity with its content. Send to bounced@test.kulamail.com or complained@test.kulamail.com to see how your tool and webhooks react.

Not supported

  • Attachments and inline images: refused with 554, never sent without them. Link to the file instead. Attachments are planned.
  • Templates and variables: send the final content, or use the API with a template.
  • Newsletters and campaigns: the relay sends transactional emails only. They have no unsubscribe header. Send newsletters as campaigns.
  • Receiving email: replies go to your Reply-To address, not to Kula.
Bulk or promotional email through SMTP breaks our acceptable use policy, like through the transactional API.

Before account approval

Until your account is approved, SMTP and the API send at most 50 emails a day to people outside your team, all spaces together, test spaces excluded. Emails to the members of your account don't count. Beyond, emails are refused with 451 4.7.1 until midnight UTC; most tools keep them and retry.

Owners and admins get an email at 40 and when the limit is reached. Approval lifts the limit.

Bounces and complaints

Kula never sends bounce emails back to your tool. Follow bounces and complaints in Activity, or with the email.bounced and email.complained webhooks. An email from SMTP shows Sent via SMTP in its details.

Guides

Supabase Auth

Sign-up, magic link and password reset emails

Ghost

Member sign-in and staff emails

WordPress

Site emails with WP Mail SMTP