SingleMail
TRLog in

Integrations

Any language can reach SingleMail with a plain HTTPS request, and apps you can't change can use SMTP. The examples below are filled in with SingleMail's real values.

Node.js / TypeScript

terminal
npm i @singlemail/node
.env
SINGLEMAIL_API_KEY=sm_…
SINGLEMAIL_BASE_URL=https://api.singlemail.singleton.com.tr
mail.ts
import { SingleMail } from "@singlemail/node";
const sm = new SingleMail();

// With an attachment and scheduling
const { data, error } = await sm.emails.send({
  from: "Uygulama <no-reply@firma.com>",
  to: ["ali@ornek.com"],
  subject: "Your monthly report",
  html: "<p>The report is attached.</p>",
  attachments: [{ filename: "rapor.pdf", content: await fs.readFile("rapor.pdf") }],
  tags: [{ name: "type", value: "report" }],
  scheduledAt: "in 1 hour",
}, { idempotencyKey: "report-2026-10" });

if (error) console.error(error.name, error.message);

The SDK never throws on API errors; every call returns { data, error }. Requests repeated with the same idempotencyKey never create a second email, so retrying after network errors is safe.

The SDK package isn't on public npm yet. Contact us to get it, or use the REST API directly.

PHP

mail.php
$ch = curl_init("https://api.singlemail.singleton.com.tr/emails");
curl_setopt_array($ch, [
  CURLOPT_POST => true,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("SINGLEMAIL_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "from" => "Uygulama <no-reply@firma.com>",
    "to" => ["ali@ornek.com"],
    "subject" => "We got your order",
    "html" => "<p>…</p>",
  ]),
]);
$res = json_decode(curl_exec($ch), true);   // ["id" => "…"]

.NET (C#)

MailService.cs
var http = new HttpClient { BaseAddress = new Uri("https://api.singlemail.singleton.com.tr") };
http.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", config["SingleMail:ApiKey"]);

var res = await http.PostAsJsonAsync("/emails", new {
    from = "Uygulama <no-reply@firma.com>",
    to = new[] { "ali@ornek.com" },
    subject = "Your appointment is confirmed",
    html = "<p>…</p>",
});
res.EnsureSuccessStatusCode();

Python

mail.py
import os, requests

r = requests.post(
    "https://api.singlemail.singleton.com.tr/emails",
    headers={"Authorization": f"Bearer {os.environ['SINGLEMAIL_API_KEY']}"},
    json={"from": "Uygulama <no-reply@firma.com>", "to": ["ali@ornek.com"], "subject": "…", "html": "<p>…</p>"},
    timeout=10,
)
r.raise_for_status()
print(r.json()["id"])

SMTP

Apps that can't call an API can use SingleMail like any SMTP server. Messages arriving over SMTP go into the same queue and logs, with the same DKIM signing and tracking.

SettingValue
Hostsmtp.singlemail.singleton.com.tr
Port2587
EncryptionSTARTTLS
Usernamesinglemail
PasswordYour API key (sm_…)
Laravel .env
MAIL_MAILER=smtp
MAIL_HOST=smtp.singlemail.singleton.com.tr
MAIL_PORT=2587
MAIL_USERNAME=singlemail
MAIL_PASSWORD=sm_…
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=no-reply@firma.com
Django settings.py
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.singlemail.singleton.com.tr"
EMAIL_PORT = 2587
EMAIL_HOST_USER = "singlemail"
EMAIL_HOST_PASSWORD = os.environ["SINGLEMAIL_API_KEY"]
EMAIL_USE_TLS = True

WordPress: In the “WP Mail SMTP” plugin, choose Other SMTP and enter the values above.

n8n: Create an SMTP credential in the “Send Email” node, or call POST /emails with an “HTTP Request” node, which also lets you send tags and an idempotency key.

Limits

LimitValue
Request rate10 requests per second per project (admins can change it)
RecipientsUp to 50 per email (to + cc + bcc)
Batch100 emails per request
Size40 MB per API request, 25 MB over SMTP; attachment URLs (path) up to 10 MB
Custom headersUp to 20; List-Unsubscribe, In-Reply-To, References and X-* (except X-SES-* and X-SingleMail-*)
SchedulingUp to 30 days ahead
Daily quotaSet per project by an admin

All error codes are listed in the API reference.