From 7f15f93a7d67b6d37f8c64b4ab4e693fd22c0286 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 9 Aug 2023 17:47:04 +0100 Subject: [PATCH] Set Reply-To for data breach emails. --- lib/data_breach.rb | 3 +++ spec/integration/report_a_data_breach_spec.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/lib/data_breach.rb b/lib/data_breach.rb index dd228011..88e3d087 100644 --- a/lib/data_breach.rb +++ b/lib/data_breach.rb @@ -53,6 +53,9 @@ def data_breach(report, logged_in_user) from = MailHandler.address_from_name_and_email( 'WhatDoTheyKnow.com data breach report', blackhole_email ) + if report.contact_email + set_reply_to_headers(nil, 'Reply-To' => report.contact_email) + end # Set a header so we can filter in the mailbox headers['X-WDTK-Contact'] = 'wdtk-data-breach-report' diff --git a/spec/integration/report_a_data_breach_spec.rb b/spec/integration/report_a_data_breach_spec.rb index c8d8b06e..5692e2b0 100644 --- a/spec/integration/report_a_data_breach_spec.rb +++ b/spec/integration/report_a_data_breach_spec.rb @@ -37,6 +37,7 @@ expect(last_email.from).to eq(['do-not-reply-to-this-address@localhost']) expect(last_email.to).to eq(['postmaster@localhost']) expect(last_email.subject).to eq('New data breach report') + expect(last_email.header["Reply-To"].value).to eq('test@example.com') expect(last_email.body).to include('URL: https://example.com') expect(last_email.body).to include('Special category or criminal offence data: Yes') expect(last_email.body).to include('DPO email: test@example.com')