DevelopmentNotification
Installation
Rails5
gem 'development_notification', "2.0.0" # and bundle
Rails4
gem 'development_notification', "0.1.3" # and bundle
Copy and run migration
$ rake development_notification:install:migrations
$ rake db:migrate
Configuration
# in /config/initializers/development_notification.rb
DevelopmentNotification.configure do |config|
config.leadersend_username = "[email protected]"
config.leadersend_api_key = "0933e545acxc063cb8a101a374cc721f"
config.domain = "example.com"
config.validate! # must be called in the very end.
end
Usage
After setup you gain access to:
- DevelopmentNotification::Email model that logs email prepared and sent.
- DevelopmentNotification::Email.send_email(parameter_hash) #=> sends emails
Email sending :bear: (the good stuff) :honeybee:
DevelopmentNotification::Email.send_email(
title: "Systemside identifier",
to: ["[email protected]", "[email protected]"],
from: "[email protected]",
fromname: "Creative",
subject: "test",
template: "html body"
)
to:
key accepts both array of strings and a single string
Gotchas
- Sometimes production does not load the gem. Append
require: false
in gemfile, and add the linerequire 'development_notification'
to/config/application.rb
Development
- Set up Ruby >= 2 (try
rvm use 2.2.3@dev_noti --create
) - Install bundler, bundle
- Review dummy app database in
spec/dummy/config/database.yml
rake db:create db:migrate db:seed RAILS_ENV=test
rspec