Improve the interface of FoodsoftMailReceiver
This commit is contained in:
parent
e9bae618ed
commit
e017a1196e
3 changed files with 24 additions and 19 deletions
|
|
@ -4,11 +4,14 @@ class BounceMailReceiver
|
|||
/bounce\+(?<local>.*)=(?<domain>[^=]+)/
|
||||
end
|
||||
|
||||
def received(match, data)
|
||||
address = "#{match[:local]}@#{match[:domain]}"
|
||||
def initialize(match)
|
||||
@address = "#{match[:local]}@#{match[:domain]}"
|
||||
end
|
||||
|
||||
def received(data)
|
||||
mail = Mail.new data
|
||||
subject = mail.subject || 'Unknown bounce error'
|
||||
MailDeliveryStatus.create email: address,
|
||||
MailDeliveryStatus.create email: @address,
|
||||
message: subject,
|
||||
attachment_mime: 'message/rfc822',
|
||||
attachment_data: data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue