Skip to content

Commit

Permalink
Use MailAddressCollection class to validate the email address.
Browse files Browse the repository at this point in the history
Resolve #21719
  • Loading branch information
maliming committed Dec 25, 2024
1 parent 5193a71 commit f14f767
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,16 @@ await Configuration.GetDefaultFromDisplayNameAsync(),
}
}

private static void ValidateEmailAddress(string emailAddress)
protected virtual Task ValidateEmailAddress(string emailAddress)
{
if(ValidationHelper.IsValidEmailAddress(emailAddress))
try
{
return;
_ = new MailAddressCollection { emailAddress };
return Task.CompletedTask;
}
catch (Exception e)
{
throw new ArgumentException($"Email address '{emailAddress}' is not valid!");
}

throw new ArgumentException($"Email address '{emailAddress}' is not valid!");
}
}

0 comments on commit f14f767

Please sign in to comment.