development
claude/smbcloud-github-app-k9641p
development
feature/apps
feature/build-release
feature/ci-docs
feature/ci-ruby-gems
feature/cicd
feature/completion
feature/dist-nuget
feature/fix-ci-sdk-pypi-rubygem
feature/fix-clippy-on-stable-channel
feature/fix-deployment-script
feature/github-email
feature/gresiq-v1
feature/project-new-structure
feature/rsync-deploy
feature/ruby-runner
feature/sdk-npm
feature/sdk-workflows
feature/smbcloud-cli-release-npm
feature/smbcloud-deploy
feature/wasm
main
release/v0.7.4
smbcloud-email (Ruby)
Ruby bindings for the smbCloud transactional email API, powered by the shared
Rust SDK (smbcloud-email-sdk) and a native
Magnus extension.
Install
gem 'smbcloud-email'
The gem ships a native extension; bundle install compiles it (Rust toolchain
required).
Usage
require 'email'
client = SmbCloud::Email.client(
environment: SmbCloud::Email::Environment::PRODUCTION,
api_key: 'smb_mail_your_key',
)
# Send
sent = client.send(
from: 'billing@example.com',
to: ['customer@acme.com'],
subject: 'Your receipt',
html: '<h1>Thanks!</h1>',
text: 'Thanks!',
idempotency_key: 'receipt-2026-0001',
)
sent[:id] # => "eml_…"
sent[:status] # => 1 (sent)
# Attachments, cc/bcc, headers, tags
client.send(
from: 'billing@example.com',
to: ['customer@acme.com'],
subject: 'Invoice',
html: '<p>See attached.</p>',
cc: ['accounts@acme.com'],
attachments: [{ filename: 'invoice.pdf', content_base64: 'JVBERi0xLjQ...' }],
headers: { 'X-Entity-Ref-ID' => 'inv_123' },
tags: { 'category' => 'invoice' },
)
# Delivery status (needs a read-scope key)
message = client.get_message('eml_…')
message[:status]
message[:events]
client.list_messages(status: 'bounced', limit: 20)
Mint an API key for your Mail app in the smbCloud console. Sending is scoped to that app's verified domain; reading messages needs a read-scope key.
Errors
Non-2xx API responses and transport failures raise SmbCloud::Email::Error, with
the parsed response body available on #payload.
License
MIT