Revert "openly fail when not delivering mail"
This reverts commit 415cc2c2f1
.
This commit is contained in:
parent
6b598fc080
commit
4343bb3918
3 changed files with 20 additions and 0 deletions
|
@ -3,6 +3,11 @@ class ApplicationMailer < ActionMailer::Base
|
|||
default from: "demarches-simplifiees.fr <#{CONTACT_EMAIL}>"
|
||||
layout 'mailer'
|
||||
|
||||
# Don’t retry to send a message if the server rejects the recipient address
|
||||
rescue_from Net::SMTPSyntaxError do |_error|
|
||||
message.perform_deliveries = false
|
||||
end
|
||||
|
||||
# Attach the procedure logo to the email (if any).
|
||||
# Returns the attachment url.
|
||||
def attach_logo(procedure)
|
||||
|
|
|
@ -4,6 +4,11 @@ class DeviseUserMailer < Devise::Mailer
|
|||
include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
|
||||
layout 'mailers/layout'
|
||||
|
||||
# Don’t retry to send a message if the server rejects the recipient address
|
||||
rescue_from Net::SMTPSyntaxError do |_error|
|
||||
message.perform_deliveries = false
|
||||
end
|
||||
|
||||
def template_paths
|
||||
['devise_mailer']
|
||||
end
|
||||
|
|
|
@ -3,6 +3,16 @@ RSpec.describe ApplicationMailer, type: :mailer do
|
|||
let(:dossier) { create(:dossier, procedure: build(:simple_procedure)) }
|
||||
subject { DossierMailer.notify_new_draft(dossier) }
|
||||
|
||||
describe 'invalid emails are not sent' do
|
||||
before do
|
||||
allow_any_instance_of(DossierMailer)
|
||||
.to receive(:notify_new_draft)
|
||||
.and_raise(Net::SMTPSyntaxError)
|
||||
end
|
||||
|
||||
it { expect(subject.message).to be_an_instance_of(ActionMailer::Base::NullMail) }
|
||||
end
|
||||
|
||||
describe 'valid emails are sent' do
|
||||
it { expect(subject.message).not_to be_an_instance_of(ActionMailer::Base::NullMail) }
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue