Skip to content

Repository files navigation

mailgun_rails

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

Installing

In your Gemfile

gem'mailgun_rails'

Usage

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

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

Now you can send emails using plain Action Mailer:

email=mailfrom: 'sender@email.com',to: 'receiver@email.com',subject: 'this is an email'
email.mailgun_variables={name_1: :value_1,name_2: value_2}
email.mailgun_recipient_variables={'user_1@email.com'=>{id: 1},'user_2@email.com'=>{id: 2}}
email.mailgun_headers={foo: 'bar'}

Pending

  • Sending attachments

Pull requests are welcomed

A NOTE ABOUT TESTING PLEASE READ: with caching enabled, the deliverer instance at the rails level is cached. therefore, since we're changing configs in the test suite, we need to make sure we use Hermes::Deliverer.new(@settings).deliver!(mail_msg) to avoid the caching behavior issues

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages