LetterOpener::Web
Notice
This project moved to Goatmail.
A Sinatra-based frontend to the letter_opener.
This provides almost the same feature as the letter_opener_web.
letter_opener_web is Rails based application. It's very useful.
But, I wanted a more simple.
Installation
First add the gem to your development environment and run the bundle command to install it.
gem 'letter_opener-web', :group => :development
Rails Setup
Then set the delivery method in config/environments/development.rb
# If you will specify a message file location.
# LetterOpener.location = Rails.root.join('tmp/letter_opener')
config.action_mailer.delivery_method = :letter_opener
And mount app, add to your routes.rb
Sample::Application.routes.draw do
if Rails.env.development?
mount LetterOpener::Web::Engine, at: "/inbox"
end
end
Padrino Setup
Then set the delivery method and mount app in config/apps.rb
Padrino.configure_apps do
if Padrino.env == :development
# If you will specify a message file location.
# LetterOpener.location = Padrino.root('tmp/letter_opener')
set :delivery_method, LetterOpener::DeliveryMethod => {}
end
end
if Padrino.env == :development
Padrino.mount('LetterOpener::Web::App').to('/inbox')
end
Padrino.mount('SampleProject::App', :app_file => Padrino.root('app/app.rb')).to('/')
Sinatra Sample
# app.rb
module Sample
class App < Sinatra::Base
configure do
set :root, File.dirname(__FILE__)
if ENV['RACK_ENV'] == 'development'
LetterOpener.location = File.join("#{root}/tmp")
Mail.defaults do
delivery_method LetterOpener::DeliveryMethod
end
end
end
end
end
# config.ru
map '/' do
run Sample::App.new
end
map '/inbox' do
run LetterOpener::Web::App.new
end
Contributing
- Fork it ( https://github.com/tyabe/letter_opener-web/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request