Sha256: edceb229546dbca7dfe182bd3b34ac1e6814d63363783033459fe192b9469c0f
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
module Mail # == Sending Email with Override Recipient SMTP # # Use the OverrideRecipientSMTP delivery method when you don't want your app # to accidentally send emails to addresses other than the overridden recipient # which you configure. # # A typical use case is in your app's staging environment, your development # team will receive all staging emails without accidentally emailing users with # active email addresses in the database. # # === Sending via OverrideRecipientSMTP # # config.action_mailer.delivery_method = :override_recipient_smtp, # to: 'staging@example.com' # # === Sending to multiple email addresses # # config.action_mailer.delivery_method = :override_recipient_smtp, # to: ['court@ovenbits.com', 'jt@ovenbits.com'] class OverrideRecipientSMTP < Mail::SMTP def initialize(values) unless values[:to] raise ArgumentError.new('A :to option is required when using :override_recipient_smtp') end super(values) end def deliver!(mail) mail.to = settings[:to] mail.cc = nil mail.bcc = nil super(mail) end end end
Version data entries
5 entries across 5 versions & 1 rubygems