mailers: ignore more SMTP errors
Although we already ignore "invalid recipient" errors, a new type of error recently popped: the mail service responds with > Net::SMTPServerBusy '400 unexpected recipients: want atleast 1, got 0' We want to also ignore this kind of errors.
This commit is contained in:
parent
640778641e
commit
e34f82a6fb
3 changed files with 22 additions and 2 deletions
|
@ -8,6 +8,12 @@ class ApplicationMailer < ActionMailer::Base
|
|||
message.perform_deliveries = false
|
||||
end
|
||||
|
||||
rescue_from Net::SMTPServerBusy do |error|
|
||||
if error.message =~ /unexpected recipients/
|
||||
message.perform_deliveries = false
|
||||
end
|
||||
end
|
||||
|
||||
# Attach the procedure logo to the email (if any).
|
||||
# Returns the attachment url.
|
||||
def attach_logo(procedure)
|
||||
|
|
|
@ -9,6 +9,12 @@ class DeviseUserMailer < Devise::Mailer
|
|||
message.perform_deliveries = false
|
||||
end
|
||||
|
||||
rescue_from Net::SMTPServerBusy do |error|
|
||||
if error.message =~ /unexpected recipients/
|
||||
message.perform_deliveries = false
|
||||
end
|
||||
end
|
||||
|
||||
def template_paths
|
||||
['devise_mailer']
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue