Solved

Retrieving the mail server host name from the DNS !

Posted on 2002-04-27
2
230 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

632 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