How can I find the MX record for a mail server in C#?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
This link might help:
Determining MXRecord of mail server
Take a look at this DNS resolver project on codeproject.com. The library has a Resolver class that contains a method named Query which can be used to go after the MX record.
You can use the answer of Robert and RPK to get the MX record of a given domain.
But you'll need a DNS server to do the job. If you want to detect the DNS server of the machine where your code is executed, you can use the following.
There is a complete solution that will do the whole job if you don't want to rewrite everything. Look for
GetMxRecords
static method.I just wrote a simple asp.net generic handler to do the job of finding the mx records which you can use to code an Windows App.
Generic Handler to find MX Records
The NMail project contains a DNS client under trunk/NMail.DnsClient. The project is available under the Apache license.
hope this helps http://www.eggheadcafe.com/articles/20050129.asp