Prüft ob die URL aufgelößt werden kann.
/// <summary>
/// Check if the URL is valid.
/// </summary>
/// <param name="smtpHost">The URL.</param>
/// <returns></returns>
public static bool IsUrlValid(string smtpHost)
{
bool response = false;
try
{
IPHostEntry ipHost = Dns.Resolve(smtpHost);
response = true;
}
catch (SocketException se)
{
response = false;
}
return response;
}
1 Kommentare zum Snippet