0.0
No commit activity in last 3 years
No release in over 3 years
When mails or messages are sent from your application, Better Opener lets you preview the rendered messages in your browser instead of delivering them.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

BetterOpener

Preview mails and other notifications in your browser instead of actually sending them out. Inspired by and similar in terms of functionality to the LetterOpener and the MailView gem BetterOpener tries to be better by:

  • providing support for outgoing notifications in general (email, sms so far)
  • supporting pre- and on-demand rendering
  • allowing remote access to notifications (helpful on staging servers and remote development machines)
  • displaying desktop notifications (with the accompanying chrome plugin)

Setup

Add the gem to your development environment and run the bundle install command to install it.

gem "better_opener", :group => :development

Then in Rails3 mount the bundled Sinatra app inline in your routes.rb:

if Rails.env == "development"
  mount BetterOpener::Server => "/notifications"
end

To prevent messages from actually being sent you need to set up email and/or sms interception.

Email

Set the delivery method in config/environments/development.rb

config.action_mailer.delivery_method = :better_opener

The design of the email interface is taken from the mail_view plugin.

SMS

SMS message support is provided for the sms_gateway gem. Edit your sms_gateway.yml file:

development:
  adapter: better_opener
  from: your_app

SMS interface:

SMS as displayed by the sinatra app

On-request Rendering

The messages that are being sent with one of the above delivery methods are static (pre-rendered at time of delivery). To preview your changes without going through all the steps to redeliver the message use the add_delayed_notification method like that:

class Emailer < ActionMailer::Base

 # ....

  def self.deliver_later(method, *params)
    if Rails.env == "development"
      BetterOpener.add_delayed_notification("email", Emailer, method, params)
    else
      Resque.enqueue(EmailJob, method, *params)
    end
  end

end

Chrome Plugin

To get actual desktop notifications, you will want to install the accompanying chrome-plugin. Point it to the (full) notification path that you mounted this gem on.

Chrome Notifications