sendmux-sending
Ruby SDK package for the Sendmux Sending API.
Documentation
- Ruby SDK guide: https://sendmux.ai/docs/sdks/ruby
- Sending API reference: https://sendmux.ai/docs/sending-api
- Source: https://github.com/Sendmux/sendmux-sdk/tree/main/packages/ruby/sending
- Changelog: https://github.com/Sendmux/sendmux-sdk/blob/main/packages/ruby/sending/CHANGELOG.md
Requirements
- Ruby 3.1 or newer.
- A send-capable
smx_mbx_key or owner-approved Sending-resourcesmx_agent_token.
Installation
gem install sendmux-sending
Or add it to your Gemfile:
gem "sendmux-sending", "~> 1.0"
Usage
Create a sending client with a send-capable key before calling generated operations.
require "sendmux/sending"
client = Sendmux::Sending::Client.new(
api_key: ENV.fetch("SENDMUX_MAILBOX_KEY")
)
request = Sendmux::Sending::Generated::EmailSendRequest.new(
from: Sendmux::Sending::Generated::Address.new(email: "sender@example.com"),
to: Sendmux::Sending::Generated::Address.new(email: "recipient@example.com"),
subject: "Hello from Sendmux",
text_body: "This message was sent with the Sendmux Ruby SDK."
)
response = client.emails.sending_send_email(
request,
Sendmux::Core::Headers.idempotency_key("send-email-001")
)
puts response.data.
Client surface
Sendmux::Sending::Client exposes:
client.emailsforsending_send_emailandsending_send_email_batch.client.metaforsending_get_open_api_spec.
Pass base_url: only when you are targeting an explicitly provided Sendmux endpoint for a controlled environment.
Idempotency and retries
Mutating sending operations accept the :idempotency_key option. Use Sendmux::Core::Headers.idempotency_key so retries are safe when a request is replayable.
client.emails.sending_send_email(
request,
Sendmux::Core::Headers.idempotency_key("send-email-002")
)
Errors
Generated API errors are mapped to Sendmux::Core::ApiError.
begin
client.emails.sending_send_email(request)
rescue Sendmux::Core::ApiError => error
warn "#{error.status} #{error.code}: #{error.}"
end
Support
- Documentation: https://sendmux.ai/docs
- Contact: contact@sendmux.ai
Licence
MIT licence. See https://github.com/Sendmux/sendmux-sdk/blob/main/LICENSE.