Remove code duplication for catching errors when sending mails
This commit is contained in:
parent
0ed3b7b7c3
commit
2264351cf5
4 changed files with 27 additions and 22 deletions
|
|
@ -7,10 +7,8 @@ class MessageNotifier < UserNotifier
|
|||
|
||||
message.recipients.each do |recipient|
|
||||
if recipient.receive_email?
|
||||
begin
|
||||
MessagesMailer.foodsoft_message(recipient, message).deliver
|
||||
rescue
|
||||
Rails.logger.warn "Deliver failed for user \##{recipient.id}: #{recipient.email}"
|
||||
Mailer.deliver_now_with_user_locale recipient do
|
||||
MessagesMailer.foodsoft_message(recipient, message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue