I was recently doing Rails development on my Mac without an internet connection. Yes it can still be done, but there are certain things that are easily overlooked. One of these was testing the ability of the application to send emails upon user registration. Since I had no connection I was wondering if there was a way to emulate this functionality.
At one point in time I remembered reading about logging emails to a file and decided to dig around in my environment config files. While digging through the test.rb configuration file I found the magic line:
config.action_mailer.delivery_method = :test
When comparing this to my development.rb configuration file I realized this line was missing (intentionally). I added the line, restarted the server, and voila, everything was configured correctly. Anytime I used my custom mailer the email was routed directly to the development.log file. I’ve found this to be a very useful mechanism for testing email functionality without needing an internet connection. It’s also very useful for rapidly prototyping and testing functionality.
Hey grt catch searching for something else in rails and ended up in your site, was not aware of this feature.