How can an IP-based program discover the SMTP server that it should
use ? I am writing software that needs to send mail, but I want to avoid
having the user enter his SMTP server name. How can I find out the
server to use, whether on-line via dial-up or LAN ? |
Request for Question Clarification by
seizer-ga
on
13 Mar 2003 14:37 PST
Do you want just a general approach, or a language-specific approach
to solving this problem? If language specific, which language :-)
Regards,
--seizer-ga
|
Clarification of Question by
soane-ga
on
14 Mar 2003 06:06 PST
I am writing for Windows, in Borland C++, but it doesn't have to be
specific. If I need to study an RFC and get it to work from that, so
be it.
To clarify "SHOULD USE" : expedience rules. Any SMTP server that sends
my mail, and doesn't upset the ISP/Adminstrator is fine by me. The
emails will be infrequent and small, so it shouldn't upset anyone. I
even thought of signing up for some SMTP service such as SMTP.com and
paying for it myself as a service to my customers, but they are all
very strict about re-assigning or transferring any type of service to
anyone else. The application that it is for is not primarily a mail
client, sending mail is just something that will happen occasionally
as a by-product of other processes.
|
Clarification of Question by
soane-ga
on
04 Apr 2003 12:50 PST
I like the suggestion from asterisk_man the most, it sounds feasible.
Just two problems though. The gethostbyname() function doesn't return
the MX records, and as far as I can tell there is no function that
does, not that I've found anyway. And although I could write my own
DNS lookup function to get the MX records, I would have to have the
address of the DNS in use, to which to send the query. How do I find
that ?(programmatically, of course, not manually).
I have tried everything I can think of and spent hours researching it
on Google without any luck. Either it's so obvious I can't see it, or
else there is no easy solution. If it's obvious I apologise in advance
!
|