Class: Renalware::Letters::Delivery::PracticeEmail

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/letters/delivery/practice_email.rb

Overview

Utility class to help us resolve the correct email address when sending to the practice. If we allow_external_mail then we use the practice email, other wise we use the email of the last user to update the letter (useful for testing, ie you get the GP email if you approve the letter) or a system default for testing if the user has no email address.

Instance Method Summary collapse

Instance Method Details

#addressObject



19
20
21
22
23
24
25
# File 'app/models/renalware/letters/delivery/practice_email.rb', line 19

def address
  if config.allow_external_mail
    practice&.email # nil is acceptable
  else
    config.fallback_email_address_for_test_messages
  end
end