Click here to Skip to main content
15,889,281 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Regarding PDF Converted file Pin
ZurdoDev2-Oct-14 5:42
professionalZurdoDev2-Oct-14 5:42 
QuestionJavascript logic causes the page to be stuck Pin
ThetaClear29-Sep-14 8:32
ThetaClear29-Sep-14 8:32 
AnswerRe: Javascript logic causes the page to be stuck Pin
Richard Deeming29-Sep-14 9:14
mveRichard Deeming29-Sep-14 9:14 
GeneralRe: Javascript logic causes the page to be stuck Pin
ThetaClear29-Sep-14 9:58
ThetaClear29-Sep-14 9:58 
GeneralRe: Javascript logic causes the page to be stuck Pin
ThetaClear4-Oct-14 5:16
ThetaClear4-Oct-14 5:16 
QuestionHow to verify email address using mx record? Pin
miss78629-Sep-14 0:37
miss78629-Sep-14 0:37 
AnswerRe: How to verify email address using mx record? Pin
Richard Deeming29-Sep-14 1:58
mveRichard Deeming29-Sep-14 1:58 
GeneralRe: How to verify email address using mx record? Pin
miss7863-Oct-14 0:36
miss7863-Oct-14 0:36 
Thank you very much for your reply. Apology for the late response.

When I tested the IsValidEmailDomain method, for my domain, it showed up as false. I tried adding in the try...catch block, but I am still getting a false domain address (####.com) and I have also tried testing it using my personal domain address (####@gmail.com), which also results in false.

I have tried compiling many variations of the test method, to catch the error within the IsValidEmailDomain, but I keep experiencing false/null for each of the domain address.

C#
public static bool IsValidEmailDomain(MailAddress address)
{
    if (address == null) return false;
    var response = DnsClient.Default.Resolve(address.Host, RecordType.Mx);
    try
    {
        if (response == null || response.AnswerRecords == null) return false;
    }
    catch (FormatException)
    {
        return false;
    }

    return response.AnswerRecords.OfType<MxRecord>().Any();
}


C#
public static string test()
   {
       string mail = "#####6@gmail.com";
       bool? answer = null;
       Exception ex;
       try
       {
           answer = IsValidEmailDomain(mail);
       }
       catch (Exception e)
       {
           ex = e;
       }
       if (answer.HasValue)
       {
           return answer.ToString();
       }
       else
       {
           return null;
           // catch exception
       }
   }

However, when I test the following domain address (###.com) with my original mx() method, it displays a mx-record (mail.###.com) for my domain address. I have also tested my mx() method using my gmail address and it outputs an mx-record for it.
C#
public static string mailMX()
   {
       string domainName = "#######.com";
       string mail = "";

       var response = DnsClient.Default.Resolve(domainName, RecordType.Mx);
       var records = response.AnswerRecords.OfType<MxRecord>();
      foreach (var record in records)
       {
          return (record.ExchangeDomainName).ToString();
       }

      return mail = records.ToString();
   }


I am trying to send email via XML to 3rd party client via web request and in order to send the email, i need to pass a email (reply.###.com) with a valid mx-record. hence, how can I build method, which define, that domain address (###.com) is valid with the following (mail.###.com) mx record.

Any hints to where I may be going wrong or what logic I should be applying, would be most helpful.
Many thanks for your time and help.

modified 3-Oct-14 6:56am.

GeneralRe: How to verify email address using mx record? Pin
Richard Deeming3-Oct-14 2:09
mveRichard Deeming3-Oct-14 2:09 
QuestionAsp.net Ajax Autocomplete Return value to Search another Pin
Member 122810828-Sep-14 22:45
Member 122810828-Sep-14 22:45 
AnswerRe: Asp.net Ajax Autocomplete Return value to Search another Pin
Sibeesh KV29-Sep-14 0:53
professionalSibeesh KV29-Sep-14 0:53 
Questionweb form using 2 gridview controls Pin
dcof26-Sep-14 4:49
dcof26-Sep-14 4:49 
QuestionReducing form size Pin
Member 876166726-Sep-14 2:31
Member 876166726-Sep-14 2:31 
AnswerRe: Reducing form size Pin
jkirkerx26-Sep-14 11:51
professionaljkirkerx26-Sep-14 11:51 
GeneralRe: Reducing form size Pin
Member 87616674-Oct-14 11:28
Member 87616674-Oct-14 11:28 
QuestionFrom active directory Lookup finding AD Attributes (ie Account Locked) Pin
Stephen Holdorf25-Sep-14 14:13
Stephen Holdorf25-Sep-14 14:13 
AnswerRe: From active directory Lookup finding AD Attributes (ie Account Locked) Pin
Stephen Holdorf25-Sep-14 14:29
Stephen Holdorf25-Sep-14 14:29 
AnswerRe: From active directory Lookup finding AD Attributes (ie Account Locked) Pin
Richard Deeming26-Sep-14 1:19
mveRichard Deeming26-Sep-14 1:19 
Questionconnectivity Pin
Member 1110901925-Sep-14 1:24
Member 1110901925-Sep-14 1:24 
AnswerRe: connectivity Pin
ZurdoDev25-Sep-14 2:09
professionalZurdoDev25-Sep-14 2:09 
AnswerRe: connectivity Pin
Sibeesh KV29-Sep-14 0:55
professionalSibeesh KV29-Sep-14 0:55 
QuestionMVC - Service Layer Question Pin
Matt U.24-Sep-14 4:25
Matt U.24-Sep-14 4:25 
AnswerRe: MVC - Service Layer Question Pin
Rohit Kukreti24-Sep-14 5:25
Rohit Kukreti24-Sep-14 5:25 
GeneralRe: MVC - Service Layer Question Pin
Matt U.24-Sep-14 5:32
Matt U.24-Sep-14 5:32 
GeneralRe: MVC - Service Layer Question Pin
Rohit Kukreti24-Sep-14 5:50
Rohit Kukreti24-Sep-14 5:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.