BasicAuth bezieht Realm aus dem Validator. DNS Resolve für E-Mail Validierung geändert. Moq-Package hinzugefügt.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user