getting SMTP server address  
Author Message
Chaman Zinga





PostPosted: Visual C++ Language, getting SMTP server address Top

i am writing an application in which it sends mail when user acknowledges something..

to make it more general..

i need to get smtp server address, but not from user..

is there any program i can write to query smtp mail address

and then send mail

let me know.




Visual C++6  
 
 
korenwolf





PostPosted: Visual C++ Language, getting SMTP server address Top

I don't think it's likely that's possible. Otherwise this functionality would also exist in normal e-mail clients like Outlook Express. But even in that software you always have to supply the SMTP server address yourself.
 
 
Dreedle





PostPosted: Visual C++ Language, getting SMTP server address Top

, you can perform a DNS lookup to retrieve the MX record for the domain 'somewhere.com'. The DNS response will return the IP addresses of one or more SMTP mail servers that will accept mail for the domain.

Applications like Outlook do not perform DNS MX lookups. They expect to be configured with a known SMTP server address to which it will direct all email - for example an SMTP server address supplied by an ISP. The SMTP server will itself perform DNS MX lookups for all destination email domains it does not recognise and forward emails to the respective servers.

In short, you do not need to know any SMTP servers if you are prepared to write the DNS MX lookup code. The DNS protocol and packet format is widely documented on the web. Basically you construct and transmit UDP packets to a DNS server and decode the response from it.



 
 
einaros





PostPosted: Visual C++ Language, getting SMTP server address Top

This is a C++ langauge forum, and we aim to deal strictly with questions regarding the C++ language as implemented by VC8, and in addition the standard libraries (STL, CRT). While we do also cover quite a few borderline queries, as well as those completely off topic, I do feel that you should restrict the amount of non-C++ questions such as this.

For further questions related to networking, visit the similarly named newsgroup at http://msdn.microsoft.com/newsgroups.