Solved

Retrieving the mail server host name from the DNS !

Posted on 2002-04-27
2
200 Views
Last Modified: 2010-04-02
SDK : C++ Builder 5

Hello,

I want to retrieve the ip address of a mail server from the DNS.

For example
When you have such address : larry@aol.com
I want to know the ip address of the mail server aol.com
and not the ip address of their Web site.

When i use the GetHostByName(), this function only returns me the ip address of the Web server.

Could you give a piece of code ...

Thank you
0
Comment
Question by:mars
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 150 total points
ID: 6973658
The socket function gethostbyname() only queries for "A" records.  To get a mail server you need to query for "MX" records.  There is no high-level socket function to do that.  You must do it yourself.

Here is an example of this:

http://www.codeguru.com/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=329921&Search=true&Forum=vc&Words=MX&Match=Whole&Topic=&Searchpage=0&Limit=25
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7036268
Please update and finalize this old, open question. Please:

1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.

EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.

Thanks,

** Mindphaser - Community Support Moderator **

P.S.  Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create string splitting user defined function in C++ 23 290
Best book to learn C++ 4 70
Unable to start eclipse ? 17 132
Embarcadero WebBroker REST server endpoint parameters 2 54
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now