1
0

BasicAuth bezieht Realm aus dem Validator. DNS Resolve für E-Mail Validierung geändert. Moq-Package hinzugefügt.

This commit is contained in:
2022-01-30 14:25:13 +01:00
parent a885f15ebb
commit 80e5382553
11 changed files with 247 additions and 19 deletions

View File

@@ -5,6 +5,7 @@ using System.Net;
using System.Net.Mail;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using DNS.Client;
using DNS.Protocol;
@@ -170,18 +171,17 @@ namespace System
var mailAddress = new MailAddress(email);
bool isValid = mailAddress.Address == email;
if (isValid && nameservers != null)
if (isValid && nameservers?.Any() == true)
{
bool exists = false;
foreach (var nameserver in nameservers)
{
var clientRequest = new ClientRequest(nameserver) { RecursionDesired = true };
clientRequest.Questions.Add(new Question(Domain.FromString(mailAddress.Host), RecordType.MX));
var client = new DnsClient(nameserver);
var waitTask = Task.Run(async () => await client.Resolve(mailAddress.Host, RecordType.MX));
waitTask.Wait();
var response = clientRequest.Resolve()
.ConfigureAwait(false)
.GetAwaiter()
.GetResult();
var response = waitTask.Result;
waitTask.Dispose();
if (response.ResponseCode != ResponseCode.NoError)
continue;