namespace KBR.Shared.Mail { public static class MailHelpers { // Replace email with other domain passed as a parameter public static string ReplaceEmailDomain(string email, string newDomain) { if (string.IsNullOrWhiteSpace(email)) throw new ArgumentException("Email cannot be null or empty.", nameof(email)); if (string.IsNullOrWhiteSpace(newDomain)) throw new ArgumentException("New domain cannot be null or empty.", nameof(newDomain)); var atIndex = email.IndexOf('@'); if (atIndex == -1) throw new ArgumentException("Invalid email format.", nameof(email)); return $"{email.Substring(0, atIndex + 1)}{newDomain}"; } } }