[Ruby SDK]
Ruby on Rails
Ship password resets and receipts from Rails controllers and Active Job with the Ruby gem.
Step 1
Install the package
Add the official Ruby client to your Ruby on Rails project.
bash
gem install reloop-emailStep 2
Set your API key
Create a free Reloop account, copy your API key, and add it to your Ruby on Rails environment.
Get an API key free โbash
RELOOP_API_KEY="re_xxxxxxxx"Step 3
Send email from Ruby on Rails
Use this Ruby on Rails snippet to send your first message. Works with Controllers ยท Active Job.
send_email.rb
1require 'reloop'2
3class EmailsController < ApplicationController4 def create5 Reloop.api_key = ENV['RELOOP_API_KEY']6
7 email = Reloop::Emails.send(8 from: 'Acme <onboarding@yourdomain.com>',9 to: [params[:to]],10 subject: 'Hello from Rails',11 html: '<strong>It works!</strong>'12 )13
14 render json: { id: email[:id] }15 end16endNext steps
Examples, docs, and API reference
Go deeper with working code and the full API for Ruby.
Send with Ruby on Rails.
Get an API key and ship transactional email from Ruby on Rails using the official Ruby SDK.