sendmux-sending

Gem Version CI Licence: MIT

Ruby SDK package for the Sendmux Sending API.

Documentation

Requirements

  • Ruby 3.1 or newer.
  • A send-capable smx_mbx_ key or owner-approved Sending-resource smx_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.message_id

Client surface

Sendmux::Sending::Client exposes:

  • client.emails for sending_send_email and sending_send_email_batch.
  • client.meta for sending_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.message}"
end

Support

Licence

MIT licence. See https://github.com/Sendmux/sendmux-sdk/blob/main/LICENSE.