Project

sendkit

0.0
The project is in a healthy, maintained state
Official Ruby SDK for the SendKit email API. Send transactional emails with a simple, zero-dependency client.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

SendKit Ruby SDK

Official Ruby SDK for the SendKit email API.

Installation

gem install sendkit

Or add to your Gemfile:

gem "sendkit"

Usage

Create a Client

require "sendkit"

client = SendKit::Client.new("sk_your_api_key")

Send an Email

result = client.emails.send(
  from: "you@example.com",
  to: "recipient@example.com",
  subject: "Hello from SendKit",
  html: "<h1>Welcome!</h1>"
)

puts result["id"]

Send a MIME Email

result = client.emails.send_mime(
  envelope_from: "you@example.com",
  envelope_to: "recipient@example.com",
  raw_message: mime_string
)

Error Handling

API errors raise SendKit::Error:

begin
  client.emails.send(...)
rescue SendKit::Error => e
  puts e.name        # e.g. "validation_error"
  puts e.message     # e.g. "The to field is required."
  puts e.status_code # e.g. 422
end

Configuration

# Read API key from SENDKIT_API_KEY environment variable
client = SendKit::Client.new

# Custom base URL
client = SendKit::Client.new("sk_...", base_url: "https://custom.api.com")