Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (18 sloc) 946 Bytes

Rails deliver mail to local file

If you want to debug mail deliveries in development mode and want to see what exactly will be sent you can tell Rails to "deliver" emails to local folder file instead of sending them via sendmail or smtp.

# config/environments/development.rb
MyApp::Application.configure do
  # ...
  config.action_mailer.delivery_method = :file
  ActionMailer::Base.file_settings = { :location => Rails.root.join('tmp/mail') }
  # ...

In Rails 4.2 there is even better solution "Mail Previews" (... or show_previews) more info http://edgeguides.rubyonrails.org/4_2_release_notes.html#action-mailer

But still if you want ho have the raw mail output, this is still valid solution.

source:

keywords: Ruby on Rails 3, Rails 4, Rails 4.1, ActionMailer file

You can’t perform that action at this time.