Ruby
Overview
Mailtrap can be integrated with Ruby apps and projects for email sending.
Email API/SMTP for Ruby
SDK integration
The Mailtrap Ruby SDK provides an idiomatic Ruby interface for sending transactional and bulk emails. The SDK supports:
Transactional email sending
Batch email sending
Template management
ActionMailer integration for Rails applications
Comprehensive error handling
Installation
Add the SDK to your Gemfile:
gem 'mailtrap'Then run:
Minimal Example Ruby on Rails (Actionmailer)
Minimal Example Ruby
Here's a minimal example to send your first email:
SMTP integration
To integrate SMTP with your Ruby app, navigate to the Integrations tab, choose either Ruby on Rails or Ruby Net/SMTP, and copy-paste the credentials or ready-made code snippets.

Read more about SMTP integration in the Email API/SMTP - SMTP Integration article.
RESTful API integration
To integrate Mailtrap using RESTful API, use the configuration available among Code samples under the API section.
API integration can be used with any Ruby framework or library that supports HTTP requests. For more details, refer to the API documentation.

Read more about API integration in the Email API/SMTP - API Integration article.
Last updated
Was this helpful?

