module Roda::RodaPlugins::MailerExt

The mailer_ext plugin extends the mailer plugin with enhanced logging and configuration options.

plugin :mailer_ext, log: (ENV["RACK_ENV"] != "test"),
                    prevent_delivery: (ENV["RACK_ENV"] != "production")

Plugin Options

The following plugin options are supported:

:log

When true, output the body of the email to STDOUT before delivery. If passed an object that responds to call, it will be called with the email object.

:prevent_delivery

Uses the Mail test mailer instead of actually attempting the delivery to a SMTP server.

Testing

With :prevent_delivery set to true, any outgoing emails are stored inside the Mail test mailer. You can access these during your tests.

refute_empty Mail::TestMailer.deliveries