Rails Action Mailer adapter for Mailgun
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gemfiles Update travis matrix Sep 18, 2016
lib Remove values that are empty arrays, such as cc: [] Oct 17, 2016
spec Remove values that are empty arrays, such as cc: [] Oct 17, 2016
.gitignore Removed Gemfile.lock Apr 1, 2015
Gemfile Added sqlite jdbc adapter as a dev dependency on jruby Mar 31, 2015
LICENSE Initial commit Aug 29, 2013
MIT-LICENSE [#1] Add license to gemspec Sep 28, 2013
README.md Showed convention of adding Your name to Sender/From header Apr 6, 2016
README.rdoc Initial commit Aug 29, 2013
mailgun_rails.gemspec Rename namespace: Mailgun -> MailgunRails Oct 16, 2016



Build Status

mailgun_rails is an Action Mailer adapter for using Mailgun in Rails apps. It uses the Mailgun HTTP API internally.


In your Gemfile

gem 'mailgun_rails'


To configure your Mailgun credentials place the following code in the corresponding environment file (development.rb, production.rb...)

config.action_mailer.delivery_method = :mailgun
config.action_mailer.mailgun_settings = {
		api_key: '<mailgun api key>',
		domain: '<mailgun domain>'

Now you can send emails using plain Action Mailer:

email = mail from: 'sender@email.com', to: 'receiver@email.com', subject: 'this is an email'
email = mail from: 'Your Name Here <sender@email.com>', to: 'receiver@email.com', subject: 'this is an email'

Mailgun variables

email.mailgun_variables = {name_1: :value_1, name_2: value_2}

Recipient Variables (for batch sending)

email.mailgun_recipient_variables = {'user_1@email.com' => {id: 1}, 'user_2@email.com' => {id: 2}}

Custom MIME headers

email.mailgun_headers = {foo: 'bar'}

Mailgun options

To provide option parameters like o:campaign or o:tag.

email.mailgun_options = {campaign: '1'}

Pull requests are welcomed