Railmail allows email to be delivered and inspected in development mode without the use of a mail server.
When Railmail is enabled, any mail sent by your application will be trapped and stored in a database table. An interface is enabled within your application where you can view these emails. With Railmail there is no need to set up testing email accounts while developing your application; just send out mail to any address and Railmail will capture it.
What it does
-
Tracks email that your application sends
-
Resends email with new recipients
-
Helps you to develop applications that use ActionMailer with no need for an smtp or sendmail setup
-
Saves the world
Add this to your Gemfile:
gem 'railmail', "~> 3.2.0", :git => "https://github.com/zonecheung/railmail.git"
To create the railmail_deliveries table after the gem is installed:
rails generate railmail_migration rake db:migrate
Add this to your development.rb:
require "mail" Mail.register_observer(Railmail::Observer)
And the last, add the resources to your routes.rb:
resources :railmail, :only => %w(index) do member do get :raw get :part end collection do post :resend post :read end end
When your application is running and Railmail is configured correctly, navigating to /railmail/ will bring you to the main interface. Also, you can add your own custom routes that navigate to the railmail controller and put the interface wherever you want in your URL scheme.