Ruby SDK
The official Render25 Ruby client gem. Simple, lightweight, and fully compatible with Ruby on Rails, Sinatra, and Sidekiq.
Ruby 2.5+ & 3.xgem: render25Rails ActionMailer
Installation
bash
gem install render25Or add to your Gemfile:
ruby
gem "render25"Basic Usage
Initialize the client. It automatically detects RENDER25_API_KEY from your environment.
send_email.rb
require "render25"
# Automatically reads RENDER25_API_KEY from environment
client = Render25.new
response = client.emails.send(
from: "support@yourdomain.com",
to: "user@example.com",
subject: "Welcome to Render25!",
html: "<h1>Welcome aboard!</h1><p>Transactional email sent via Ruby.</p>",
text: "Welcome aboard! Transactional email sent via Ruby."
)
puts "Dispatched ID: #{response['id']}"Note
Set
RENDER25_API_KEY in your environment variables.CC, BCC & Custom Reply-To
advanced.rb
require "render25"
client = Render25.new
response = client.emails.send(
from: "support@yourdomain.com",
to: ["client@example.com"],
cc: ["accounting@example.com"],
bcc: ["archive@example.com"],
reply_to: "helpdesk@yourdomain.com",
subject: "Invoice #1042 Ready",
html: "<p>Your monthly statement is ready.</p>"
)File Attachments
Attach PDF invoices or spreadsheets by passing raw file binary data:
attachments.rb
require "render25"
client = Render25.new
response = client.emails.send(
from: "billing@yourdomain.com",
to: "client@example.com",
subject: "Your Invoice #1042",
html: "<p>Please find your receipt attached below.</p>",
attachments: [
{
filename: "invoice_1042.pdf",
content: File.binread("invoice.pdf"), # Binary file contents
content_type: "application/pdf"
}
]
)Ruby on Rails Integration
Configure ActionMailer in config/environments/production.rb:
config/environments/production.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.render25.com",
port: 587,
user_name: ENV["RENDER25_USERNAME"],
password: ENV["RENDER25_API_KEY"],
authentication: :plain,
enable_starttls_auto: true
}