Use case
Transactional email API and SMTP relay
Send the messages your app depends on, such as receipts, password resets and sign-in codes, from your own domain. Call the REST API, or point the framework you already use at the SMTP relay.
- HTTP API
- POST /send/ answers 202 with a message_id. Statuses: queued, sending, delivered, bounced, failed.
- SMTP relay
- smtp.scrubimail.com, port 587, STARTTLS. Username is your account email, password is an API key with the send scope.
- Sender
- Your own verified domain, signed with DKIM.
- Cost
- 1 sending credit per email.
What you use
The pieces that do the work
Your own authenticated domain
Add a domain and publish the SPF, DKIM and DMARC records the dashboard shows. Mail is only sent from domains you have verified.
POST /send/domains/
Templates and personalisation
Start from one of 11 starters, including welcome, email confirmation, password reset, sign-in alert and order confirmation, and personalise with tags and fallbacks.
{{first_name|there}}
Attachments and inline images
Attach up to 10 files totalling 10 MB, or embed an image with a content ID. Executable file types are refused.
attachments, content_id
A check on every message
Whether it arrives over the API or SMTP, the From domain must be verified, the recipient must not be suppressed and you must have credits.
550 5.7.1 with the reason
Automatic suppression
Hard bounces and unsubscribes land on your suppression list, and suppressed addresses are never emailed.
GET /send/suppressions/
Delivery tracking
Follow each message from queued to delivered or bounced, and watch your 30-day reputation score.
GET /send/status/{message_id}/
How it works
From a new domain to delivered mail
- 01
Verify your sending domain
Add the domain, publish its SPF and DKIM records (and DMARC, which is recommended) and verify. It counts as verified when SPF and DKIM pass.
- 02
Create a send key
In the dashboard, create an API key with the send scope. Copy it when it is shown.
- 03
Choose the API or SMTP
Call POST /send/ from your code, or enter the relay settings in your framework or plugin. Both use the same domains, suppression list and credits.
- 04
Send and track
The API answers 202 with a message_id. Follow it with the status endpoint, and use history and analytics for the bigger picture.
In code
Send with the API or the relay
Authenticate API calls with the X-API-Key header. The SMTP relay takes the same key as its password.
- from_email must be on the sending domain you reference in sending_domain_id, or the request is rejected with 400.
- Leave list_unsubscribe off for transactional mail such as receipts and password resets.
- If you leave out text_content, a plain-text part is generated from the HTML.
- The credit is taken when the call is accepted and given back if the message is refused or cannot be handed off.
curl -X POST "https://api.scrubimail.com/scrubimail/api/v1/send/" \
-H "X-API-Key: $SCRUBIMAIL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sending_domain_id": "YOUR_DOMAIN_ID",
"from_email": "[email protected]",
"from_name": "Your Company",
"to_email": "[email protected]",
"to_name": "Ada Lovelace",
"subject": "Welcome, {{first_name|there}}",
"html_content": "<p>Hi {{first_name|there}}, thanks for joining.</p>",
"text_content": "Hi {{first_name|there}}, thanks for joining.",
"tags": ["welcome"]
}'const res = await fetch("https://api.scrubimail.com/scrubimail/api/v1/send/", {
method: "POST",
headers: {
"X-API-Key": process.env.SCRUBIMAIL_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
sending_domain_id: "YOUR_DOMAIN_ID",
from_email: "[email protected]",
from_name: "Your Company",
to_email: "[email protected]",
to_name: "Ada Lovelace",
subject: "Welcome, {{first_name|there}}",
html_content: "<p>Hi {{first_name|there}}, thanks for joining.</p>",
text_content: "Hi {{first_name|there}}, thanks for joining.",
tags: ["welcome"],
}),
});
const message = await res.json(); // 202 Accepted, with message_idimport os
import requests
res = requests.post(
"https://api.scrubimail.com/scrubimail/api/v1/send/",
headers={"X-API-Key": os.environ["SCRUBIMAIL_API_KEY"]},
json={
"sending_domain_id": "YOUR_DOMAIN_ID",
"from_email": "[email protected]",
"from_name": "Your Company",
"to_email": "[email protected]",
"to_name": "Ada Lovelace",
"subject": "Welcome, {{first_name|there}}",
"html_content": "<p>Hi {{first_name|there}}, thanks for joining.</p>",
"text_content": "Hi {{first_name|there}}, thanks for joining.",
"tags": ["welcome"],
},
timeout=15,
)
message = res.json() # 202 Accepted, with message_id<?php
$ch = curl_init("https://api.scrubimail.com/scrubimail/api/v1/send/");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"X-API-Key: " . getenv("SCRUBIMAIL_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"sending_domain_id" => "YOUR_DOMAIN_ID",
"from_email" => "[email protected]",
"from_name" => "Your Company",
"to_email" => "[email protected]",
"to_name" => "Ada Lovelace",
"subject" => "Welcome, {{first_name|there}}",
"html_content" => "<p>Hi {{first_name|there}}, thanks for joining.</p>",
"text_content" => "Hi {{first_name|there}}, thanks for joining.",
"tags" => ["welcome"],
]),
]);
$message = json_decode(curl_exec($ch), true); // 202 Accepted, with message_id
curl_close($ch);{
"id": "e5f6a7b8-...",
"to_email": "[email protected]",
"status": "sending",
"message_id": "d4e5f6a7-...",
"credits_consumed": 1
}const nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({
host: "smtp.scrubimail.com",
port: 587,
secure: false, // STARTTLS is negotiated after connecting
requireTLS: true,
auth: {
user: "[email protected]", // your ScrubiMail account email
pass: process.env.SCRUBIMAIL_API_KEY, // an API key with the send scope
},
});
await transporter.sendMail({
from: '"Your App" <[email protected]>', // an address on a verified domain
to: "[email protected]",
subject: "Welcome aboard",
html: "<p>Thanks for signing up!</p>",
});# settings.py
import os
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.scrubimail.com"
EMAIL_PORT = 587
EMAIL_USE_TLS = True # STARTTLS
EMAIL_HOST_USER = "[email protected]" # your ScrubiMail account email
EMAIL_HOST_PASSWORD = os.environ["SCRUBIMAIL_API_KEY"] # key with the send scope
DEFAULT_FROM_EMAIL = "Your App <[email protected]>"# .env
MAIL_MAILER=smtp
MAIL_HOST=smtp.scrubimail.com
MAIL_PORT=587
MAIL_ENCRYPTION=tls
[email protected]
MAIL_PASSWORD=your_scrubimail_api_key
[email protected]
MAIL_FROM_NAME="Your App"# WP Mail SMTP plugin: Settings > Mailer > "Other SMTP"
From Email: [email protected] (an address on a verified domain)
From Name: Your Company
Mailer: Other SMTP
SMTP Host: smtp.scrubimail.com
Encryption: TLS (STARTTLS on port 587; do not choose SSL)
SMTP Port: 587
Authentication: On
SMTP Username: [email protected] (your ScrubiMail account email)
SMTP Password: your_scrubimail_api_key (an API key with the send scope)import os
import smtplib
from email.message import EmailMessage
msg = EmailMessage()
msg["From"] = "Your App <[email protected]>"
msg["To"] = "[email protected]"
msg["Subject"] = "Welcome aboard"
msg.set_content("Thanks for signing up!")
with smtplib.SMTP("smtp.scrubimail.com", 587) as s:
s.starttls()
s.login("[email protected]", os.environ["SCRUBIMAIL_API_KEY"])
s.send_message(msg)Go deeper
Where to read next
- ProductEmail sendingDomains, templates, suppressions, dedicated IPs and reputation.Open
- DocsSending API referencePOST /send/, status, templates, campaigns and the SMTP relay settings.Open
- PricingPlans and creditsMonthly plans, pay-as-you-go credits and every limit, side by side.Open
Also see:Signup verificationList cleaning
FAQ
Frequently asked questions
Short answers, checked against how the API behaves.
Should I use the API or the SMTP relay?
Use the API when you are writing the sending code yourself: it needs only HTTPS and returns a message_id you can track. Use the SMTP relay for frameworks, plugins and tools that only speak SMTP, such as WordPress, Django, Laravel and Nodemailer. If your host blocks outbound port 587, send with the API instead.
Do I have to verify a domain first?
Yes. You can only send from a domain you have verified, which keeps other people from sending as you. Publish the SPF and DKIM records the dashboard shows and verify; DNS changes usually take minutes and can take up to 48 hours.
Which From addresses can I use?
Over the HTTP API, from_email must be on the sending domain you reference, and a different domain is rejected with a 400. Over SMTP, any address on a verified domain works, and a message from an unverified domain is refused with 550 5.7.1.
Can I send password resets and receipts?
Yes. That is the typical use. Leave one-click unsubscribe off for transactional messages, and start from the password reset, email confirmation or order confirmation starter templates if you want a head start.
What happens when a message bounces?
A hard bounce marks the message as bounced and adds the address to your suppression list automatically, so it is not emailed again. Soft bounces, such as a full mailbox, do not add the address.
Can I check addresses before I send?
Yes. Validate addresses first and hard bounces drop, which protects your sender reputation. See signup verification for checking addresses on a form, and list cleaning for existing lists. The Free plan includes 200 sending credits a month. Signing up does not ask for a card.
Send your first message in minutes
Create an account, verify a domain and make the request above, or point your app at the relay.