Developer guides

Send email API guides for every stack

Step-by-step guides for sending email through tinyRelay: the REST API from cURL, Node.js, Python, PHP, Go and Ruby; the SMTP relay from Laravel, Django, Rails and Supabase; and signed webhooks you can verify.

curl -X POST https://api.tinyemail.com/v1/relay/email/campaign \
  -H "Content-Type: application/json" \
  -H "X-RELAY-ACCESS-TOKEN: $TINYRELAY_API_KEY" \
  --data-binary @reset.json
# HTTP 202 { "requestId": "…", "message": "SUCCESS" }
const res = await fetch("https://api.tinyemail.com/v1/relay/email/campaign", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-RELAY-ACCESS-TOKEN": process.env.TINYRELAY_API_KEY,
  },
  body: JSON.stringify(email),
});
# tinyrelay.py  (pip install requests)
import os

import requests

API_URL = "https://api.tinyemail.com/v1/relay/email/campaign"
$ch = curl_init('https://api.tinyemail.com/v1/relay/email/campaign');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'X-RELAY-ACCESS-TOKEN: ' . getenv('TINYRELAY_API_KEY'),
    ],
REST · ext-curlSend email with PHP →
const apiURL = "https://api.tinyemail.com/v1/relay/email/campaign"

req, err := http.NewRequest(http.MethodPost, apiURL, bytes.NewReader(payload))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-RELAY-ACCESS-TOKEN", os.Getenv("TINYRELAY_API_KEY"))
REST · net/httpSend email in Go →
module TinyRelay
  SEND_URI = URI("https://api.tinyemail.com/v1/relay/email/campaign")

  def self.send_email(email)
    request = Net::HTTP::Post.new(SEND_URI)
    request["X-RELAY-ACCESS-TOKEN"] = ENV.fetch("TINYRELAY_API_KEY")
REST · Net::HTTPSend email with Ruby →
# settings.py
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = os.environ["TINYRELAY_SMTP_HOST"]        # [SMTP host]
EMAIL_PORT = int(os.environ["TINYRELAY_SMTP_PORT"])   # [port]
EMAIL_HOST_USER = os.environ["TINYRELAY_SMTP_USER"]
EMAIL_HOST_PASSWORD = os.environ["TINYRELAY_SMTP_PASSWORD"]
MAIL_MAILER=smtp
# Issued at onboarding
MAIL_HOST="[SMTP host]"
MAIL_PORT="[port]"
MAIL_USERNAME="[SMTP username]"
MAIL_PASSWORD="[SMTP password]"
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:   ENV.fetch("TINYRELAY_SMTP_HOST"),           # [SMTP host]
  port:      Integer(ENV.fetch("TINYRELAY_SMTP_PORT")),  # [port]
  user_name: Rails.application.credentials.dig(:tinyrelay, :smtp_user_name),
  password:  Rails.application.credentials.dig(:tinyrelay, :smtp_password),
SMTP · production.rbRails Action Mailer SMTP →
curl -X PATCH "https://api.supabase.com/v1/projects/$PROJECT_REF/config/auth" \
  -H "Authorization: Bearer $SUPABASE_ACCESS_TOKEN" \
  -d '{
    "smtp_host": "[SMTP host]",
    "smtp_port": "[port]",
    "smtp_user": "[SMTP username]",
SMTP · Auth configSupabase custom SMTP →
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
6
languages over the REST API
4
framework SMTP setups
7
webhook event types to handle
REST or SMTP?

Same infrastructure. Different on-ramps.

Both send through the same tinyRelay infrastructure. The difference is how your app hands the email over.

SMTP vs API, in depth →
REST API
For code you write
  • Many recipients in one request
  • Per-recipient attributes and metadata
  • Signed webhooks with your metadata
Transactional email API →
SMTP relay
For software that already sends
  • Framework mailers and auth providers
  • Credentials issued at onboarding
  • No integration code
SMTP relay service →
FAQ

Before you pick a guide.

Field-level detail lives in the Send Email API reference.

Do I need to install a package to follow these guides?

No. There are no packages to install. Every REST API guide uses a standard HTTP client, and tinyRelay works with any language that can make HTTP requests.

Use an SMTP guide when a framework or tool already sends email and you only want to change where it goes. Use a REST API guide when you want one request for many recipients, each with their own attributes and metadata.

They are issued at onboarding together with your SMTP credentials, so the SMTP guides show them as placeholders. API keys are issued at onboarding too.

Get started

Send transactional email with a service that reports back.

SMTP relay or REST API, standalone or alongside tinyEmail. Tell us what you send and our team sets you up.