Class: BounceMailReceiver
- Inherits:
-
Object
- Object
- BounceMailReceiver
- Defined in:
- app/mail_receivers/bounce_mail_receiver.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(match) ⇒ BounceMailReceiver
constructor
A new instance of BounceMailReceiver.
- #received(data) ⇒ Object
Constructor Details
#initialize(match) ⇒ BounceMailReceiver
Returns a new instance of BounceMailReceiver.
6 7 8 |
# File 'app/mail_receivers/bounce_mail_receiver.rb', line 6 def initialize(match) @address = "#{match[:local]}@#{match[:domain]}" end |
Class Method Details
.regexp ⇒ Object
2 3 4 |
# File 'app/mail_receivers/bounce_mail_receiver.rb', line 2 def self.regexp /bounce\+(?<local>.*)=(?<domain>[^=]+)/ end |
Instance Method Details
#received(data) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/mail_receivers/bounce_mail_receiver.rb', line 10 def received(data) mail = Mail.new data subject = mail.subject || 'Unknown bounce error' MailDeliveryStatus.create email: @address, message: subject, attachment_mime: 'message/rfc822', attachment_data: data end |