Project

dm_courier

0.0
No commit activity in last 3 years
No release in over 3 years
A delivery method that abstract the most common email delivery APIs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 2.6
>= 0
>= 0
~> 3.4
~> 0.36
~> 0.11

Runtime

= 0.9.8
~> 1.0.53
~> 1.0.2
 Project Readme

DM Courier

Build Status Gem Version security Test Coverage Code Climate

Stick with just one Gem and be free to choose your email delivery service. DM Courier (Delivery Method Courier) allows you to easily change the deliery method as you wish.

Rails Setup

First, add the gem to your Gemfile and run the bundle command to install it.

gem 'dm_courier'

Second, set the delivery method in config/environments/production.rb.

 config.action_mailer.delivery_method = :dm_courier

Third, create an initializer such as config/initializers/dm_courier.rb and paste in the following code:

DMCourier.configure do |config|
  config.api_key = ENV['DM_COURIER_APIKEY']
  config.service_name = :mandrill # Choose here the service you want to use
end

NOTE: If you don't already have an environment variable for delivery service API key, don't forget to create one.

Available configuration options

Any option with Mailer Support can be used inside the mailer like:

class MyMailer < ActionMailer::Base
  default track_opens: false

  def notify_user(email)
    mail(auto_html: false, inline_css: true)
  end
end
Option Mailer Support Description
api_key false Your service API key
Default: ENV['DM_COURIER_API_KEY']
service_name false Your service API name.
Default: ENV['DM_COURIER_SERVICE']
async false If the message with be sent asynchronous (depends on the service support)
Default: false
Services: mandrill
from true A default from address for all emails
Services: all
auto_html true whether or not to automatically generate an HTML part for messages that are not given HTML
Services: mandrill
auto_text true whether or not to automatically generate a text part for messages that are not given text
Services: mandrill
important true whether or not this message is important, and should be delivered ahead of non-important messages
Default: false
Services: mandrill
inline_css true whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size
Services: mandrill, sparkpost
track_clicks true whether or not to turn on click tracking for the message
Services: mandrill, sparkpost
track_opens true whether or not to turn on open tracking for the message
Services: mandrill, sparkpost
track_url_without_query_string true whether or not to strip the query string from URLs when aggregating tracked URL data
Services: mandrill
log_content true set to false to remove content logging for sensitive emails
Services: mandrill
bcc_address true an optional address to receive an exact copy of each recipient's email
Services: mandrill, sendgrid
return_path_domain true a custom domain to use for the messages's return-path
Services: mandrill, sparkpost
signing_domain true a custom domain to use for SPF/DKIM signing (for "via" or "on behalf of" in email clients)
Services: mandrill
subaccount true the unique id of a subaccount - must already exist or will fail with an error
Services: mandrill
tracking_domain true a custom domain to use for tracking opens and clicks
Services: mandrill
tags true an array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.
Services: mandrill

Services

Mandrill

SparkPost

The options were choosen to create an abstraction layer above the original service API. Because of that some options have different names:

  • return_path_domain: Is called return_path on SparkPost
  • track_opens: Is called open_tracking on SparkPost
  • track_clicks: Is called click_tracking on SparkPost

TODO: Sparkpost service implementation does not support BCC emails yet.

SendGrid

Development & Feedback

Questions or problems? Please use the issue tracker. If you would like to contribute to this project, fork this repository. Pull requests appreciated.

This gem is based on the mandrill_dm gem.