0.0
The project is in a healthy, maintained state
Rails engine, generators, ActiveJob support, inbox previews and rake tasks for Courrier.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 7.0
~> 0.11.0
>= 3.1, < 4
>= 7.0
 Project Readme

Rails Courrier

Rails-specific features for Courrier, the API-powered email delivery gem for Ruby.

Preview of the Rails Courrier inbox with a list of images on the left and preview of an email on the right

Rails Designer logo

Sponsored By Rails Designer

Installation

Add to your Gemfile:

bundle add rails_courrier

Setup

Generate the initializer:

bin/rails generate courrier:install

This creates config/initializers/courrier.rb.

Generate an email:

bin/rails generate courrier:email Order

This creates app/emails/order_email.rb.

Mount the engine for inbox previews:

# config/routes.rb
mount Courrier::Engine => "/courrier"

Usage

Send emails

OrderEmail.deliver to: "recipient@railsdesigner.com"

Deliver later via ActiveJob

OrderEmail.deliver_later to: "recipient@railsdesigner.com"

Configure queue options in the email class:

class OrderEmail < Courrier::Email
  enqueue queue: "emails", wait: 5.minutes

  def subject = "Your order is ready!"
  # …
end

Inbox provider

Preview emails in your browser:

# config/initializers/courrier.rb
Courrier.configure do |config|
  config.email = { provider: "inbox" }
end

Enable auto-open:

config.email = { provider: "inbox" }
config.inbox.auto_open = true

Clear inbox files:

bin/rails courrier:clear

URL helpers

Rails Courrier automatically includes Rails URL helpers in your email classes:

class OrderEmail < Courrier::Email
  def text
    "View your order: #{order_url(token: "abc123")}"
  end
end

Documentation

See the Courrier README for full configuration, providers, layouts, templates and more.

Contributing

This project uses Standard for formatting Ruby code. Please make sure to run rake before submitting pull requests.

License

Courrier is released under the MIT License.