Skip to content

anupamkakade/slactionmailer

 
 

Repository files navigation

Slactionmailer

Slactionmailer is a mailer for ActionMailer that sends your message to a Slack channel.

Gem Version

Installation

Simple include the gem in your gemfile.

gem 'slactionmailer'

Or install from the command line.

gem install slactionmailer

Setup

In your environment or .env file, declare the following variables:

SLACK_WEBHOOK_URL=your incoming webhook url
SLACK_CHANNEL=#your slack channel
SLACK_USERNAME=SlactionMailer (or whaterver you want to call it)

Usage

Slactionmailer can be used as the default mailer

#config/environments/development.rb
config.action_mailer.delivery_method => :slack

Or only be used for certain messages

def notification
  mail(:from => '[email protected]',           
       :to => '[email protected]', 
       :subject => 'Subject',
       :delivery_method => :slack)
end

Either way, your mailer messages will appear like this: image

If you want to change the default message template, add the following to your config

config.slaction_mailer.template = File.read('my_template.text.erb')

##About

Slactionmailer uses slack-notify to communicate with Slack and takes inspiration from the letter-opener gem.

This project rocks and uses MIT-LICENSE.

About

Send ActionMailer messages to Slack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 99.0%
  • HTML 1.0%