Integrations / Ruby on Rails
Sendersy + Ruby on Rails
Rails + Sendersy via HTTParty or a custom ActionMailer DeliveryMethod.
1. Install
bash
gem install httparty
2. Environment variables
bash
export SENDERSY_API_KEY=sk_live_...
3. Send an email
rb
# app/services/sendersy_mailer.rb
require 'httparty'
class SendersyMailer
include HTTParty
base_uri 'https://api.sendersy.com/v1'
def self.send_welcome(email:, name:)
post('/emails',
headers: {
'Authorization' => "Bearer #{ENV['SENDERSY_API_KEY']}",
'Content-Type' => 'application/json',
},
body: {
from: 'Sendersy <noreply@yourcompany.com>',
to: [email],
subject: "Welcome, #{name}!",
html: "<p>Thanks for signing up, <strong>#{name}</strong>!</p>",
}.to_json,
)
end
end