Ruby
Sinatra
Learn how to send your first email using Sinatra and the Resend Ruby SDK.
Prerequisites
To get the most out of this guide, you’ll need to:
1. Install
Get the Resend Ruby SDK.
2. Send email using HTML
The easiest way to send an email is by using the html
parameter.
index.rb
require "sinatra"
require "resend"
set :port, 5000
set :bind, "0.0.0.0"
Resend.api_key = ENV["RESEND_API_KEY"]
get "/" do
content_type :json
params = {
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'hello world',
html: '<strong>it works!</strong>',
}
Resend::Emails.send(params).to_hash.to_json
end
3. Try it yourself
Sinatra Example
See the full source code.
Was this page helpful?