Gem Version

circuit_rails

circuit_rails is an Action Mailer adapter for sending messages to Circuit from Rails apps. It uses the Circuit REST API thru the circuit_client gem.

Installing

In your Gemfile

gem 'circuit_rails'

Usage

In your environment configuration (development.rb, production.rb, ...) configure circuit settings:

config.action_mailer.circuit_settings = {
  client_id: '<your client_id>',
  client_secret: '<your client_secret>',
}

If you want to set it as default delivery_method:

config.action_mailer.delivery_method = :circuit

Or create a base class for circuit mailers:

# apps/mailers/circuit_mailer.rb
class CircuitMailer < ApplicationMailer
  self.delivery_method = :circuit
  # default conversation: '<your default conversation>'
end

Then use this class in your mailers:

# apps/mailers/hello_world_mailer.rb
class HelloWorldMailer < CircuitMailer
  def hello_world
    mail(subject: 'Hello World!', conversation: '<convId>')
  end
end