Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Cache delivery method for ActionMailer
Latest commit dba523f @p0deje Notes on different approach

Action Mailer Cache Delivery Build Status Gem Version

Enhances ActionMailer to support the :cache delivery method, which behaves like :test, except that the deliveries are marshalled to a temporary cache file, thus making them available to other processes.

You'll want to use this gem if you're testing with Selenium (or any other tool which distinct processes). Another approach would be to share deliveries between threads (in this case, this gem is not needed at all).


Add to Gemfile

gem 'action_mailer_cache_delivery'

Now run bundle install


Change delivery method in your config/environments/test.rb

config.action_mailer.delivery_method = :cache

You can optionally specify location for cache file.

config.action_mailer.cache_settings = { :location => "#{Rails.root}/tmp/mail.cache" }

To access the cached deliveries in another process, just do


Use with parallel_tests

If you use parallel_tests to run your tests in parallel, you may get unexpected errors like EOFError. If so, make sure cache files differ for processes. Change you config/environment/test.rb

config.action_mailer.cache_settings = { :location => "#{Rails.root}/tmp/cache/action_mailer_cache_delivery#{ENV['TEST_ENV_NUMBER']}.cache" }


I tried to list there everyone who forked original version on GitHub. If you're not here, just send pull request.

Something went wrong with that request. Please try again.