HI everyone.
I seached this site for SMTP.GOt some results.Everyone says to look into the RFCs for finding out how to get the SMTP server for a domain. Nobody ever says how to do it. I read the RFC's 882, 883, 974 etc. It drove me nuts:confused: :rolleyes: .Are there any socket API that helps you to get this info like gethostbyname which gets the IP for a domain name.

Thomas Antony:confused:
Posted on 2003-12-30 05:01:30 by thomasantony
I don't think you can 'get' that, it has to be userspecified. AFAIK SMTP does not broadcast its presence. (I just skimmed through the RFC but haven't found anything contradicting my belief)
Posted on 2003-12-30 05:25:15 by Hiroshimator
Please:confused: :notsure: :( Please give me some GOOD hints. Like especially how to get the address of the mailbox for a domain name

Thomas Antony:confused: :mad:
Posted on 2003-12-30 09:02:42 by thomasantony
If you want to connect to an SMTP server then you must know its address.
you can try connecting to
mail.domain.com or relay.domain.com as those are the most common names for an smtp server but there is no guarantee.
Posted on 2003-12-30 09:26:34 by ENF
OK i will try that:alright: :stupid: .But can someone tell me how to find the exact address using DNS:confused:

Thomas Antony
Posted on 2003-12-30 11:08:36 by thomasantony
You are on the right track. You can find the mailserver or servers for a given domain by querying its domain name server (DNS). In particular, we are interested in one small part of the DNS protocol itself, we want to know about DNS Mail Records, otherwise known as MX Records.
In order to find the mailserver or servers, we must look once again at how email works. We need to understand just how it is that one mailserver wishing to send some email locates a destination mailserver. The answer is MX LOOKUP.
Looking more closely at the MX Records returned from such a DNS request, we find each is labelled with a value that identifies the priority of the server, ie, which mailserver the sending email server should attempt to connect to first. Aha !! Not only is there a way to identify the major mailserver of a domain, there is a way to map ALL such servers (provided that they are advertised in the DNS).
I will leave the rest to you.

Have a nice day :)
Posted on 2003-12-30 11:51:44 by Homer
Thanx for that info. But how do I query a DNS name server for MX Records. And how do I find the DNS name server of the ISP of the user?

Thoms Antony:stupid: :confused: :stupid:
Posted on 2003-12-31 05:59:19 by thomasantony
Posted on 2003-12-31 14:06:43 by Jnrz
Hi, I will try that search.
BTW I found a console app called nslookup in Windows XP. It won't work in 98 due to some missing imports(ntdll.dll DNSAPI.dll). It uses sockets API. So there must be some way to query a name server using sockets API.:confused: :stupid: :stupid:

Thomas Antony
Posted on 2003-12-31 23:36:34 by thomasantony
RFCs 1034 and 1035 could make you understand how to query a DNS. Also, there is an SDK function that you can use: DnsQuery, but unfortunately will not work on 9x.

edit: DnsQuery is included in a C library. You cannot use it directly from asm.
Posted on 2004-01-04 16:34:00 by hosam_shahin
Go look in the algorithms forum, I just posted an MX Lookup demo..
Posted on 2004-01-05 03:42:04 by Homer