Class: AlchemyCrm::BounceReceiver

Inherits:
ActionMailer::Base
  • Object
show all
Defined in:
app/mailers/alchemy_crm/bounce_receiver.rb

Instance Method Summary collapse

Instance Method Details

#receive(email) ⇒ Object



4
5
6
7
8
9
10
# File 'app/mailers/alchemy_crm/bounce_receiver.rb', line 4

def receive(email)
  return unless email.content_type == "multipart/report"
  bounce = BouncedDelivery.from_email(email)
  recipient = Recipient.find_by_message_id(bounce.original_message_id)
  recipient.bounced = (bounce.status == "Failure")
  recipient.save!
end