Das geht am besten über diese Komponente.
Installation über nuget:
Install-Package EmailValidation
Codebeispiel:
using System;
using EmailValidation;
namespace Example {
public class Program
{
public static void Main ()
{
do {
Console.Write ("Enter an email address: ");
var input = Console.ReadLine ();
if (input == null)
break;
input = input.Trim ();
Console.WriteLine ("{0} is {1}!", input, EmailValidator.Validate (input) ? "valid" : "invalid");
} while (true);
Console.WriteLine ();
}
}
}
Posted by Stephan Blaurock to Programming KB (2018-04-26 07:52)