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

ASP.NET

 
QuestionRegarding PDF Converted file Pin
Member 1105767029-Sep-14 21:14
Member 1105767029-Sep-14 21:14 
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 
Ignore the ExchangeDomainName - that's just the name of the server which accepts email for the specified domain.

If there are any MX records for the domain, then the domain is valid. It won't tell you whether the mailbox actually exists, but you can't determine that without trying to send an email.

Try something like this:
C#
public static bool IsValidEmailDomain(MailAddress address)
{
    if (address == null) return false;
    
    // TODO: Check what this method does with an invalid or unknown domain.
    // If it throws an exception, you'll need a try..catch block.
    var response = DnsClient.Default.Resolve(address.Host, RecordType.Mx);
    if (response == null || response.AnswerRecords == null) return false;
    
    return response.AnswerRecords.OfType<MxRecord>().Any();
}

public static bool IsValidEmailDomain(string address)
{
    if (string.IsNullOrWhiteSpace(address)) return false;
    
    MailAddress theAddress;
    try
    {
        theAddress = new MailAddress(address);
    }
    catch (FormatException)
    {
        return false;
    }
    
    return IsValidEmailDomain(theAddress);
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: How to verify email address using mx record? Pin
miss7863-Oct-14 0:36
miss7863-Oct-14 0:36 
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 

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.