Ruby email API
Send email from Ruby in one HTTP call.
No SDK to install and no mail server to run. Aslio is a plain REST endpoint, so Net::HTTP from the standard library is all you need — no gem to install. Rails apps can also use Action Mailer over SMTP. You pay ₹0.02 a message — about $0.21 per 1,000 emails, with no monthly platform fee, no per-seat charge and no minimum commitment.
In short
To send transactional email from Ruby, POST to `https://aslio.asli.one/v1/email/send` with an Authorization: Bearer API key and a JSON body containing from, to, subject and html. Aslio charges ₹0.02 a message — about $0.21 per 1,000 — with no monthly fee. Add an Idempotency-Key header and the request is safe to retry.
Facts and prices last checked .
- $0.21
- per 1,000 emails
- ₹0
- monthly platform fee
- 0
- seats to buy
- 587
- SMTP relay, same price
Code
Sending one email from Ruby
Plain Net::HTTP, so it works in Rails, Sinatra or a script. Prefer Action Mailer? Point its SMTP settings at aslio.asli.one:587 instead. The from address must be on a domain you have verified, so the message is signed with your own DKIM rather than a shared pool.
require "net/http"
require "json"
uri = URI("https://aslio.asli.one/v1/email/send")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch('ASLIO_API_KEY')}"
req["Content-Type"] = "application/json"
# Safe to retry: a duplicate replays the original response.
req["Idempotency-Key"] = "invoice-#{invoice_id}"
req.body = {
from: "Acme <billing@acme.com>",
to: ["customer@example.com"],
subject: "Your invoice is ready",
html: "<p>Hello — your invoice is attached.</p>",
statusCallbackUrl: "https://acme.com/hooks/aslio"
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true, read_timeout: 10) do |http|
http.request(req)
end
raise "Aslio #{res.code}: #{res.body}" unless res.is_a?(Net::HTTPSuccess)
message = JSON.parse(res.body)Code
Receiving delivery events in Sinatra
Aslio posts SENT, DELIVERED, BOUNCED, COMPLAINED and FAILED events to your statusCallbackUrl. Read the raw body before anything parses it. In a Rails controller, use request.raw_post.
require "sinatra"
require "json"
require "openssl"
require "rack/utils"
post "/hooks/aslio" do
raw = request.body.read
timestamp = request.get_header("HTTP_X_ASLIO_TIMESTAMP").to_s
signature = request.get_header("HTTP_X_ASLIO_SIGNATURE").to_s
expected = OpenSSL::HMAC.hexdigest(
"SHA256", ENV.fetch("ASLIO_WEBHOOK_SECRET"), "#{timestamp}.#{raw}"
)
halt 401 unless Rack::Utils.secure_compare(expected, signature)
# The timestamp is in milliseconds. Refuse anything older than five minutes.
halt 401 if ((Time.now.to_f * 1000) - timestamp.to_i).abs > 300_000
event = JSON.parse(raw)
mark_address_bad(event["toAddress"]) if event["status"] == "BOUNCED"
status 200
endCode
Sending to a list
The same key and the same wallet. Merge variables are per recipient.
POST /v1/email/send-batch
{
"from": "Acme <news@acme.com>",
"subject": "Hi {{firstName}}, your invoice is due",
"html": "<p>Hi {{firstName}} — {{plan}}</p>",
"recipients": [
{ "email": "priya@example.com",
"variables": { "firstName": "Priya", "plan": "Pro" } }
]
}
// Up to 1,000 recipients per call. Each gets its own message
// row, its own charge and its own unsubscribe link. Suppressed
// addresses are skipped and reported, never silently dropped.What you get
Common problems when sending from Ruby
What usually goes wrong in this language, and what to do about it.
Slow sends in a Rails request
Move the call into Active Job or Sidekiq. Pass the invoice or order ID to the job and build the Idempotency-Key from it, so retries reuse the key.
Keys generated inside the job
SecureRandom.uuid in perform gives each retry a new key, which means a second email. Derive the key from your own record instead.
CSRF protection blocking the webhook
A Rails controller receiving webhooks needs skip_before_action :verify_authenticity_token. The signature check takes its place.
The default read timeout is 60 seconds
Net::HTTP will wait that long unless you set read_timeout. The example uses 10, which suits a web request.
Honestly
Before you pick this
- We hold no SOC 2 report and no ISO 27001 certification. If your procurement requires one, we will not pass it today and would rather say so now.
- SMS and WhatsApp are still in build. Email is the channel that ships today. Do not pick Aslio this week for a multi-channel launch next week.
- Support runs 09:30–18:30 IST (UTC+5:30). That overlaps European and Gulf afternoons and the edges of the North American day. There is no 24/7 desk.
- We are a young, small company — Asli One Global was incorporated in February 2026. That is a legitimate thing to weigh for a critical dependency.
FAQ
Frequently asked questions
How do I send an email from Ruby?
POST to https://aslio.asli.one/v1/email/send with an Authorization: Bearer header carrying your API key, and a JSON body of from, to, subject and html. Plain Net::HTTP, so it works in Rails, Sinatra or a script. Prefer Action Mailer? Point its SMTP settings at aslio.asli.one:587 instead. The full example is above.
Do I need to install a package?
No. Aslio is a plain REST API, so Net::HTTP from the standard library is all you need — no gem to install. Rails apps can also use Action Mailer over SMTP. There is no SDK to keep up to date and no dependency to audit.
Does it work with Action Mailer?
Yes. Set smtp_settings to address: "aslio.asli.one", port: 587, enable_starttls_auto: true and password: your API key. Your mailers do not change.
Can I send from Sidekiq?
Yes, and for anything beyond a small application you should. Keep the Idempotency-Key stable across retries by building it from the record being emailed.
How much does it cost?
₹0.02 per email, which is roughly $0.21 per 1,000 messages, with no monthly platform fee, no per-seat charge and no minimum commitment. You top up a prepaid wallet and spend it down. An optional Pro plan at ₹999 a month raises the API rate limit to 100 requests a second and adds priority support.
Send your first Ruby email in ten minutes.
Top up a wallet and send. No monthly platform fee, no seat charge, no minimum commitment — a hundred test emails costs about two rupees.
Asli One Global Private Limited · CIN U62011TN2026PTC190105