SDKs and code samples

SendNeo is a plain JSON API over HTTPS, so any HTTP client works. Every sample below sends the same receipt, with an Idempotency-Key so a retry never sends it twice. Set SENDNEO_API_KEY first — a test key (sn_test_…) while you build. The request fields are described in Sending.

Resend SDKs

The Resend Node SDK reads RESEND_BASE_URL and sends requests to SendNeo. Use the SendNeo key in RESEND_API_KEY; the variable name remains the SDK's expected name.

export RESEND_BASE_URL='https://sendneo.yorkermedia.com/api'
export RESEND_API_KEY='sn_test_your_key'

If your SDK version does not read RESEND_BASE_URL, configure its base URL option or call SendNeo's REST endpoint directly. The important value is https://sendneo.yorkermedia.com/api, with /api included. See Migrate from Resend for the endpoint mapping.

Node.js

const res = await fetch("https://sendneo.yorkermedia.com/api/emails", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SENDNEO_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": "receipt-4821",
  },
  body: JSON.stringify({
    from: "Acme <receipts@mail.acme.com>",
    to: ["ada@example.com"],
    subject: "Your receipt #4821",
    html: "<p>Thanks for your order.</p>",
  }),
});
console.log(res.status, await res.json()); // 200 { id: "…" }

Python

import os

import requests

res = requests.post(
    "https://sendneo.yorkermedia.com/api/emails",
    headers={
        "Authorization": f"Bearer {os.environ['SENDNEO_API_KEY']}",
        "Idempotency-Key": "receipt-4821",
    },
    json={
        "from": "Acme <receipts@mail.acme.com>",
        "to": ["ada@example.com"],
        "subject": "Your receipt #4821",
        "html": "<p>Thanks for your order.</p>",
    },
    timeout=30,
)
res.raise_for_status()
print(res.json())  # {'id': '…'}

PHP

<?php
$ch = curl_init("https://sendneo.yorkermedia.com/api/emails");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("SENDNEO_API_KEY"),
        "Content-Type: application/json",
        "Idempotency-Key: receipt-4821",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "from" => "Acme <receipts@mail.acme.com>",
        "to" => ["ada@example.com"],
        "subject" => "Your receipt #4821",
        "html" => "<p>Thanks for your order.</p>",
    ]),
]);
echo curl_exec($ch);

Ruby

require "net/http"
require "json"

uri = URI("https://sendneo.yorkermedia.com/api/emails")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("SENDNEO_API_KEY")}"
req["Content-Type"] = "application/json"
req["Idempotency-Key"] = "receipt-4821"
req.body = {
  from: "Acme <receipts@mail.acme.com>",
  to: ["ada@example.com"],
  subject: "Your receipt #4821",
  html: "<p>Thanks for your order.</p>"
}.to_json

res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
puts res.code, res.body

Go

package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"from":    "Acme <receipts@mail.acme.com>",
		"to":      []string{"ada@example.com"},
		"subject": "Your receipt #4821",
		"html":    "<p>Thanks for your order.</p>",
	})
	req, _ := http.NewRequest("POST", "https://sendneo.yorkermedia.com/api/emails", bytes.NewReader(body))
	req.Header.Set("Authorization", "Bearer "+os.Getenv("SENDNEO_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Idempotency-Key", "receipt-4821")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	out, _ := io.ReadAll(res.Body)
	fmt.Println(res.Status, string(out))
}

Rust

// Cargo.toml: reqwest = { version = "0.12", features = ["json"] }
//             serde_json = "1", tokio = { version = "1", features = ["full"] }
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
    let res = reqwest::Client::new()
        .post("https://sendneo.yorkermedia.com/api/emails")
        .bearer_auth(std::env::var("SENDNEO_API_KEY").expect("set SENDNEO_API_KEY"))
        .header("Idempotency-Key", "receipt-4821")
        .json(&json!({
            "from": "Acme <receipts@mail.acme.com>",
            "to": ["ada@example.com"],
            "subject": "Your receipt #4821",
            "html": "<p>Thanks for your order.</p>"
        }))
        .send()
        .await?;
    let status = res.status();
    println!("{status} {}", res.text().await?);
    Ok(())
}

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class SendReceipt {
    public static void main(String[] args) throws Exception {
        String json = """
            {
              "from": "Acme <receipts@mail.acme.com>",
              "to": ["ada@example.com"],
              "subject": "Your receipt #4821",
              "html": "<p>Thanks for your order.</p>"
            }
            """;
        HttpRequest request = HttpRequest.newBuilder(URI.create("https://sendneo.yorkermedia.com/api/emails"))
            .header("Authorization", "Bearer " + System.getenv("SENDNEO_API_KEY"))
            .header("Content-Type", "application/json")
            .header("Idempotency-Key", "receipt-4821")
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();
        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}

.NET

using System.Net.Http.Headers;
using System.Net.Http.Json;

using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SENDNEO_API_KEY"));
http.DefaultRequestHeaders.Add("Idempotency-Key", "receipt-4821");

var response = await http.PostAsJsonAsync("https://sendneo.yorkermedia.com/api/emails", new
{
    @from = "Acme <receipts@mail.acme.com>",
    to = new[] { "ada@example.com" },
    subject = "Your receipt #4821",
    html = "<p>Thanks for your order.</p>",
});
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");

Elixir

Mix.install([{:req, "~> 0.5"}])

response =
  Req.post!("https://sendneo.yorkermedia.com/api/emails",
    auth: {:bearer, System.fetch_env!("SENDNEO_API_KEY")},
    headers: [{"idempotency-key", "receipt-4821"}],
    json: %{
      from: "Acme <receipts@mail.acme.com>",
      to: ["ada@example.com"],
      subject: "Your receipt #4821",
      html: "<p>Thanks for your order.</p>"
    }
  )

IO.inspect({response.status, response.body})

CLI

curl -fsSL https://sendneo.yorkermedia.com/cli/sendneo -o sendneo && chmod +x sendneo
export SENDNEO_API_KEY=sn_live_…

./sendneo send --from "Acme <receipts@mail.acme.com>" --to ada@example.com \
  --subject "Your receipt #4821" --html "<p>Thanks for your order.</p>" \
  --idempotency-key receipt-4821

REST

curl -X POST https://sendneo.yorkermedia.com/api/emails \
  -H "Authorization: Bearer $SENDNEO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: receipt-4821" \
  -d '{
    "from": "Acme <receipts@mail.acme.com>",
    "to": ["ada@example.com"],
    "subject": "Your receipt #4821",
    "html": "<p>Thanks for your order.</p>"
  }'

SMTP

Coming soon. The SMTP relay is coming soon. Until then, send through the API — the relay will take the same API key as its password.