Documentation
Send email in Ruby.
Works with: Ruby 3.0 or newer, standard library only.
Install
Get a key under API keys in the dashboard and verify a sending domain first (how). Then add the library:
Send an email
This sends one message and passes an idempotency key, so repeating the request can never deliver it twice. Pass an idempotency key and the same key never sends twice, so a retry after a timeout is safe.
More on what you can put in a message (cc, bcc, attachments, tags, templates, scheduling) is under Sending.
Rails
With the gem in your Gemfile, :mailtruss is registered as an Action Mailer delivery method, so existing mailers need no change.
Verify webhook signatures
Mailtruss signs every webhook with the Standard Webhooks scheme. Check the signature before you trust a request. Use request.raw_post so the signature is checked against the exact bytes received.
Events, payloads and retries are on the Webhooks page.
Handle errors
Failures are Mailtruss::Error with name, status and request_id. Every error name, with its cause and fix, is in the error catalogue.