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)