From 133373bc6b9a35013e744a9f45d1ed40cd2be060 Mon Sep 17 00:00:00 2001 From: Anthony Britton <105213050+anthony-britton-moj@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:09:47 +0000 Subject: [PATCH] PI-2649 (#4531) --- .../uk/gov/justice/digital/hmpps/service/MailboxService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/justice-email-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/MailboxService.kt b/projects/justice-email-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/MailboxService.kt index cc9e114b1..dd0179cda 100644 --- a/projects/justice-email-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/MailboxService.kt +++ b/projects/justice-email-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/MailboxService.kt @@ -45,7 +45,8 @@ class MailboxService( body = ItemBody().apply { content = "Reason for the contact not being created: ${event.reason}" } toRecipients = listOf(Recipient().apply { emailAddress = toEmailAddress }) } - graphServiceClient.me().sendMail().post(SendMailPostRequestBody().apply { setMessage(message) }) + graphServiceClient.users().byUserId(emailAddress) + .sendMail().post(SendMailPostRequestBody().apply { setMessage(message); saveToSentItems = true }) telemetryService.trackEvent( "UnableToCreateContactFromEmail", mapOf("emailId" to event.email.id, "reason" to event.reason)