This is a very simple regular expression, but it will show the principle.
(There are plenty of other variants out there)
The problem with adding hard coded names into the expression is that you need to update the expression in order support a new one.
A maybe better way is to have a list with valid names. This list can be configurable and easy to change later on.
Regex MailExpression = new Regex(@"(?<name>\S+)@(?<provider>\S+)\.(?<code>\S+)");
List<string> validProviderNames = new List<string> {"yahoo", "gmail", "whatever" };
string testAddress = "harry.hacker@yahaa.com";
Match m = MailExpression.Match(testAddress);
if (m.Success)
{
string providerName = m.Groups["provider"].Value;
if (!validProviderNames.Contains(providerName.ToLower()))
{
throw new Exception(String.Format("The provider name '{0}' is not valid.", providerName));
}
else
{
}
}