Solved

Retrieving the mail server host name from the DNS !

Posted on 2002-04-27
2
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
c++ substatte a varabe for a string in a LPCTSTR statment 8 101
VS2015 Redefinition errors 4 104
How do i run a c++ file? 15 58
C++ help/ Toy problem 19 71
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

739 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