sendflit gem. It has no runtime dependencies and uses the standard library’s net/http. It requires Ruby 2.7 or later.
Looking for another language? See the SDK overview.
Install
Gemfile:
Create a client
Send an email
send takes keyword arguments. The keys are the same as the API’s fields.
send returns the response as a Hash with string keys. The id is what you use to look up or cancel the email later.
Keyword arguments you can pass:
nil values are dropped before the request is sent.
Attachments
Each attachment is a Hash withfilename:, content: and an optional content_type:. The SDK base64-encodes content for you.
- Up to 10 attachments per message.
- Up to 10 MB per attachment. Larger files are rejected with
422.
Batch sending
batch sends up to 100 emails in one request. Pass an array of Hashes with the same keys as send.
results array in the same order as your input, and a count. An empty array raises TypeError, and more than 100 emails raises RangeError, before any request is made. See Batch sending.
Manage emails
cancel_email removes an email that hasn’t been sent yet. If the email was already sent, the API returns an error, which the SDK raises as SendFlit::Error.
Domains
Suppressions
reason: is optional and defaults to "unsubscribe". See Emails.
Usage and health
Verify webhooks
SendFlit signs each webhook. TheX-Sendflit-Signature header carries sha256=<hex>, an HMAC-SHA256 of the raw body. Use the class method to check it.
OpenSSL.secure_compare, which runs in constant time. See Webhooks for the event list.
Errors and retries
Every failed request raisesSendFlit::Error:
Network problems and timeouts aren’t wrapped. They raise the standard Ruby exceptions, such as
Net::OpenTimeout, Net::ReadTimeout or SocketError.
429 or 5xx are retried up to max_retries times. Other 4xx responses are not retried. See Errors, retries and limits.
Method reference
Next steps
- Quickstart: send your first email from the command line.
- Batch sending: limits and per-item results.
- Webhooks: events and payloads.