diff --git a/app/mailers/domain_mailer.rb b/app/mailers/domain_mailer.rb
index 9b942504b..1eb4341c9 100644
--- a/app/mailers/domain_mailer.rb
+++ b/app/mailers/domain_mailer.rb
@@ -153,4 +153,13 @@ class DomainMailer < ApplicationMailer
subject: "#{I18n.t(:pending_delete_expired_notification_subject,
name: @domain.name)} [#{@domain.name}]")
end
+
+ def delete_confirmation(domain)
+ @domain = domain
+
+ return if whitelist_blocked?(@domain.registrant.email)
+ mail(to: @domain.registrant.email,
+ subject: "#{I18n.t(:delete_confirmation_subject,
+ name: @domain.name)} [#{@domain.name}]")
+ end
end
diff --git a/app/models/epp/domain.rb b/app/models/epp/domain.rb
index cc5dba270..2cd3458a4 100644
--- a/app/models/epp/domain.rb
+++ b/app/models/epp/domain.rb
@@ -438,6 +438,7 @@ class Epp::Domain < Domain
user = ApiUser.find(pending_json['current_user_id'])
frame = Nokogiri::XML(pending_json['frame'])
statuses.delete(DomainStatus::PENDING_DELETE)
+ DomainMailer.delete_confirmation(self).deliver_now
clean_pendings! if epp_destroy(frame, user, false)
end
diff --git a/app/views/mailers/domain_mailer/delete_confirmation.html.erb b/app/views/mailers/domain_mailer/delete_confirmation.html.erb
new file mode 100644
index 000000000..acc915787
--- /dev/null
+++ b/app/views/mailers/domain_mailer/delete_confirmation.html.erb
@@ -0,0 +1,15 @@
+Tere,
+
+Domeeni <%= @domain.name %> kustutamise taotlus on registreerija poolt kinnitatud. Domeen <%= @domain.name %> on peatatud ja kustub registrist.
+
+Lugupidamisega
+Eesti Interneti SA
+
+
+
+Hi,
+
+Domain <%= @domain.name %> deletion confirmed and will be deleted.
+
+Best Regards,
+Estonian Internet Foundation
diff --git a/app/views/mailers/domain_mailer/delete_confirmation.text.erb b/app/views/mailers/domain_mailer/delete_confirmation.text.erb
new file mode 100644
index 000000000..a587b7f78
--- /dev/null
+++ b/app/views/mailers/domain_mailer/delete_confirmation.text.erb
@@ -0,0 +1,15 @@
+Tere,
+
+Domeeni <%= @domain.name %> kustutamise taotlus on registreerija poolt kinnitatud. Domeen <%= @domain.name %> on peatatud ja kustub registrist.
+
+Lugupidamisega
+Eesti Interneti SA
+
+--------------------------------------
+
+Hi,
+
+Domain <%= @domain.name %> deletion confirmed and will be deleted.
+
+Best Regards,
+Estonian Internet Foundation
diff --git a/config/locales/en.yml b/config/locales/en.yml
index bebe2bef0..97a17e3da 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -786,6 +786,7 @@ en:
domain_pending_deleted_subject: "Kinnitustaotlus domeeni %{name} kustutamiseks .ee registrist / Application for approval for deletion of %{name}"
pending_delete_rejected_notification_subject: "Domeeni %{name} kustutamise taotlus tagasi lükatud / %{name) deletion declined"
pending_delete_expired_notification_subject: "Domeeni %{name} kustutamise taotlus on tühistatud / %{name} deletion cancelled"
+ delete_confirmation_subject: "Domeeni %{name} kustutatud / %{name} deleted"
whois: WHOIS
login_failed_check_id_card: 'Log in failed, check ID card'
not_valid_domain_verification_title: Domain verification not available
diff --git a/spec/mailers/domain_mailer_spec.rb b/spec/mailers/domain_mailer_spec.rb
index 9d5172352..bf06d4677 100644
--- a/spec/mailers/domain_mailer_spec.rb
+++ b/spec/mailers/domain_mailer_spec.rb
@@ -276,10 +276,10 @@ describe DomainMailer do
end
end
- describe 'pending delete rejected notification' do
+ describe 'pending delete expired notification' do
before :all do
@registrant = Fabricate(:registrant, email: 'test@example.com')
- @domain = Fabricate(:domain, name: 'delete-pending-expired.ee', registrant: @registrant)
+ @domain = Fabricate(:domain, name: 'pending-delete-expired.ee', registrant: @registrant)
@domain.deliver_emails = true
@domain.registrant_verification_token = '123'
@domain.registrant_verification_asked_at = Time.zone.now
@@ -302,4 +302,31 @@ describe DomainMailer do
@mail.body.encoded.should =~ /deletion cancelled/
end
end
+
+ describe 'pending delete rejected notification' do
+ before :all do
+ @registrant = Fabricate(:registrant, email: 'test@example.com')
+ @domain = Fabricate(:domain, name: 'delete-confirmed.ee', registrant: @registrant)
+ @domain.deliver_emails = true
+ @domain.registrant_verification_token = '123'
+ @domain.registrant_verification_asked_at = Time.zone.now
+ @mail = DomainMailer.delete_confirmation(@domain)
+ end
+
+ it 'should render email subject' do
+ @mail.subject.should =~ /deleted/
+ end
+
+ it 'should have sender email' do
+ @mail.from.should == ["noreply@internet.ee"]
+ end
+
+ it 'should send confirm email to old registrant email' do
+ @mail.to.should == ["test@example.com"]
+ end
+
+ it 'should render body' do
+ @mail.body.encoded.should =~ /confirmed and will be deleted/
+ end
+ end
end