Giter VIP home page Giter VIP logo

letter_opener_web's Introduction

letter_opener_web

Build Status Gem Version Code Climate Gitter chat

Gives letter_opener an interface for browsing sent emails.

Check out http://letter-opener-web.herokuapp.com to see it in action.

Installation

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

group :development do
  gem 'letter_opener_web'
end

Usage

Add to your routes.rb:

Your::Application.routes.draw do
  if Rails.env.development?
    mount LetterOpenerWeb::Engine, at: "/letter_opener"
  end
end

And make sure you have :letter_opener delivery method configured for your app. Then visit http://localhost:3000/letter_opener after sending an email and have fun.

If you are running the app from a Vagrant machine, you might want to skip letter_opener's launchy calls and avoid messages like these:

12:33:42 web.1  | Failure in opening /vagrant/tmp/letter_opener/1358825621_ba83a22/rich.html
with options {}: Unable to find a browser command. If this is unexpected, Please rerun with
environment variable LAUNCHY_DEBUG=true or the '-d' commandline option and file a bug at
https://github.com/copiousfreetime/launchy/issues/new

In that case (or if you just want to browse mails using the web interface), you can set :letter_opener_web as your delivery method on your config/environments/development.rb:

config.action_mailer.delivery_method = :letter_opener_web

# If not everyone on the team is using vagrant
config.action_mailer.delivery_method = ENV['USER'] == 'vagrant' ? :letter_opener_web : :letter_opener

If you're using :letter_opener_web as your delivery method, you can change the location of the letters by adding the following to an initializer (or in development.rb):

LetterOpenerWeb.configure do |config|
  config.letters_location = Rails.root.join('your', 'new', 'path')
end

Usage on Heroku

Some people use this gem on staging environments on Heroku and to set that up is just a matter of moving the gem out of the development group and enabling the route for all environments on your routes.rb.

In order words, your Gemfile will have:

gem 'letter_opener_web'

And your routes.rb:

Your::Application.routes.draw do
  mount LetterOpenerWeb::Engine, at: "/letter_opener"
end

You might also want to have a look at the sources for the demo available at https://github.com/fgrehm/letter_opener_web_demo.

NOTICE: Using this gem on Heroku will only work if your app has just one Dyno and does not send emails from background jobs. For updates on this matter please subscribe to GH-35

Acknowledgements

Special thanks to @alexrothenberg for some ideas on this pull request.

Contributing

  1. Fork it and run bin/setup
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

letter_opener_web's People

Contributors

amatsuda avatar davekaro avatar evie404 avatar fgrehm avatar graywh avatar iurifq avatar joejwright avatar josisusan avatar kimrgrey avatar kmcphillips avatar mdesantis avatar mjc-gh avatar pseudomuto avatar rosenfeld avatar sunny avatar tricknotes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.