Documentation · Website · RubyGems · GitHub
Resent Ruby SDK
The official Ruby library for Resent transactional email.
Install
gem install resent
Or add to your Gemfile:
gem "resent"
bundle install
Setup
- Verify a sending domain in the Resent dashboard
- Create an API key under Settings → API keys
- Store it as
RESENT_API_KEY
require "resent"
resent = Resent.new(ENV.fetch("RESENT_API_KEY"))
Usage
require "resent"
resent = Resent.new(ENV.fetch("RESENT_API_KEY"))
result = resent.emails.send(
from: "Acme <noreply@yourdomain.com>",
to: "you@example.com",
subject: "Hello World",
html: "<p>Congrats on sending your <strong>first email</strong> with Resent!</p>"
)
puts result["submission_id"]
Send email using HTML
result = resent.emails.send(
from: "Acme <noreply@yourdomain.com>",
to: ["you@example.com"],
subject: "Hello World",
html: "<strong>It works!</strong>"
)
Send email using text
result = resent.emails.send(
from: "Acme <noreply@yourdomain.com>",
to: "you@example.com",
subject: "Hello World",
text: "It works!"
)
Docs
License
MIT © Resent