Posted about 8 years ago. Visible to the public. Linked content.

Mailcatcher: An alternative to inaction_mailer

Looks simpler than inaction_mailer:

Copy
gem install mailcatcher mailcatcher

Setup Rails to send mails to 127.0.0.1:1025. Usually you want the following config in config/environments/development.rb and maybe in test.rb or cucumber.rb.

Copy
config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => 'localhost', :port => 1025 }

Now you can see sent mails in your browser when opening http://127.0.0.1:1080

Note: In order to see the emails in the MailCatcher interface and keep your cucumber features running, copy the attached initializer to your config/initializers directory.
After that you have to change the delivery_method in your environment config from :smtp to :mailcatcher.
Now the mails will be send to MailCatcher via SMTP and stored in the ActionMailer::Base.deliveries array, too.

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Owner of this card:

Avatar
Thomas Eisenbarth
Last edit:
10 months ago
by Arne Hartherz
Attachments:
mailcatcher_send_and_save_for_test.rb
Keywords:
mail, catch, inspect, catcher
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Thomas Eisenbarth to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more