Sha256: 84af7b92ba07e17e1e37fe10c32bb58c1e9b412ec05533dee41922666221c5d1
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module Goldencobra class ConfirmationMailer < ActionMailer::Base default from: 'do-not-reply@goldencobra.de' default subject: '' default content_type: 'text/plain' def send_confirmation_mail(email = nil) if email mail to: email, subject: 'Herzlich Willkommen bei Goldencobra.de' else do_not_deliver! end end end # http://stackoverflow.com/questions/6550809/rails-3-how-to-abort-delivery-method-in-actionmailer module ActionMailer class Base # A simple way to short circuit the delivery of an email from within # deliver_* methods defined in ActionMailer::Base subclases. def do_not_deliver! raise AbortDeliveryError end def process(*args) begin super *args rescue AbortDeliveryError self.message = BlackholeMailMessage end end end end class AbortDeliveryError < StandardError end class BlackholeMailMessage < Mail::Message def self.deliver false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
goldencobra-1.1.0 | app/mailers/goldencobra/confirmation_mailer.rb |
goldencobra-1.0.9.3 | app/mailers/goldencobra/confirmation_mailer.rb |