The official Ruby client for sending emails via the SendSculpt Mailer API.
Installation
Add this line to your application’s Gemfile:
And then execute:
Or install it directly:
gem install sendsculpt-sdk
Quick Start
Initialize the client with your API Key.
require 'sendsculpt'
client = Sendsculpt::Client.new('your-api-key')
begin
response = client.send_email(
to: ['recipient@example.com'],
subject: 'Welcome to SendSculpt!',
from_email: 'noreply@yourdomain.com',
body_html: '<p>Hello! This is a test email from the SendSculpt Ruby SDK.</p>'
)
puts "Success: #{response}"
rescue => e
puts "Failed to send: #{e.message}"
end
Advanced Usage
The Ruby SDK provides a convenience layer for file attachments. Providing a file_path will automatically base64-encode it for upload.
require 'sendsculpt'
client = Sendsculpt::Client.new('your-api-key')
begin
response = client.send_email(
to: ['john@doe.com'],
subject: 'Your Monthly Invoice',
from_email: 'billing@yourdomain.com',
template_id: 'your-template-uuid',
template_data: {
first_name: 'John',
invoice_amount: '49.99'
},
cc: ['finance@yourdomain.com'],
attachments: [
{
filename: 'invoice.pdf',
file_path: '/path/to/local/invoice.pdf', # Auto-converted to Base64!
mime_type: 'application/pdf'
}
]
)
puts "Email queued successfully. Message ID: #{response['message_id']}"
rescue => e
puts e.message
end
For local development, pass the base URL as the second argument: Sendsculpt::Client.new('your-api-key', 'https://api.sendsculpt.com/api/v1').