diff --git a/api/src/ProposalSystem.Api/Services/DevEmailService.cs b/api/src/ProposalSystem.Api/Services/DevEmailService.cs index a0447d6..2eadb9a 100644 --- a/api/src/ProposalSystem.Api/Services/DevEmailService.cs +++ b/api/src/ProposalSystem.Api/Services/DevEmailService.cs @@ -18,9 +18,26 @@ public class DevEmailService : IEmailService string pdfUrl, CancellationToken ct = default) { + var maskedRecipient = MaskEmail(toEmail); _logger.LogInformation( "Dev mode - skipping email delivery: proposal {ProposalNumber} to {Recipient}, PDF link: {PdfUrl}", - proposalNumber, toEmail, pdfUrl); + proposalNumber, maskedRecipient, pdfUrl); return Task.CompletedTask; } + + private static string MaskEmail(string email) + { + if (string.IsNullOrWhiteSpace(email)) + { + return "[redacted]"; + } + + var atIndex = email.IndexOf('@'); + if (atIndex <= 1) + { + return "[redacted]"; + } + + return $"{email[0]}***{email.Substring(atIndex)}"; + } }