Files
agrynco 2757869176 feat: consume transactional email notifications
Add contract validation, SMTP delivery results, terminal failure context, neutral development seeding, and local Docker setup.

Ref: IT-1033
2026-08-04 12:32:28 +03:00

23 lines
729 B
C#

namespace HrynCo.NotificationService.Worker.Services.EmailProcessing;
public static class RecipientAddressRedactor
{
public static string Redact(string? address)
{
if (string.IsNullOrWhiteSpace(address))
return "<missing>";
int separator = address.LastIndexOf('@');
if (separator <= 0 || separator == address.Length - 1)
return "***";
string local = address[..separator];
string domain = address[(separator + 1)..];
int dot = domain.LastIndexOf('.');
string domainName = dot > 0 ? domain[..dot] : domain;
string suffix = dot > 0 ? domain[dot..] : string.Empty;
return $"{local[0]}***@{domainName[0]}***{suffix}";
}
}