Sha256: 5007a557fab970b80bc0a4ff405c591530ecac2b13d751303a738216cdb7dd9f
Contents?: true
Size: 1.13 KB
Versions: 2
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. # # An 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: ['dan@example.com', 'harlow@example.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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
suspenders-1.2.0 | templates/override_recipient_smtp.rb |
suspenders-1.1.5 | templates/override_recipient_smtp.rb |