mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
Make sure what expired domain emails will not be sent to non-valid addreses
This commit is contained in:
parent
91093b274d
commit
29f7aa19ac
4 changed files with 33 additions and 18 deletions
|
@ -43,8 +43,11 @@ class DomainExpireMailer < ApplicationMailer
|
|||
|
||||
# Needed because there are invalid emails in the database, which have been imported from legacy app
|
||||
def filter_invalid_emails(emails:, domain:)
|
||||
emails.select do |email|
|
||||
valid = EmailValidator.new(email).valid?
|
||||
old_validation_type = Truemail.configure.default_validation_type
|
||||
Truemail.configure.default_validation_type = :regex
|
||||
|
||||
results = emails.select do |email|
|
||||
valid = Truemail.valid?(email)
|
||||
|
||||
unless valid
|
||||
logger.info("Unable to send DomainExpireMailer#expired email for domain #{domain.name} (##{domain.id})" \
|
||||
|
@ -53,5 +56,7 @@ class DomainExpireMailer < ApplicationMailer
|
|||
|
||||
valid
|
||||
end
|
||||
Truemail.configure.default_validation_type = old_validation_type
|
||||
results
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class DomainPresenter
|
||||
delegate :name, :transfer_code, :registrant, :registrant_id, to: :domain
|
||||
delegate :name, :transfer_code, :registrant, :registrant_id, :id, to: :domain
|
||||
|
||||
def initialize(domain:, view:)
|
||||
@domain = domain
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue