Google Answers Logo
View Question
 
Q: SMTP server discovery. ( No Answer,   3 Comments )
Question  
Subject: SMTP server discovery.
Category: Computers > Internet
Asked by: soane-ga
List Price: $5.00
Posted: 13 Mar 2003 13:09 PST
Expires: 09 Apr 2003 13:29 PDT
Question ID: 175782
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
!
Answer  
There is no answer at this time.

Comments  
Subject: Re: SMTP server discovery.
From: donphiltrodt-ga on 13 Mar 2003 15:17 PST
 
On behalf of users everywhere, THANK YOU! :-)

You may have heard of DHCP.  It's an agreed-upon standard for devices
(PCs) hooked to a network to find their way "on the internet".  No
such standard exists for SMTP servers.  Therefore, the user has NO
choice but to manually enter their SMTP (or POP3) server name or
address at some point... into SOME program.

The best you can do (and I'll bet it's sufficient) is to copy the info
the user has already entered into some other program, say, Outlook or
Outlook Express.  Or Eudora.

To get at that info, you'll have to scan the user's registry and/or
harddrive and look in the places that these programs store the info.
Subject: Re: SMTP server discovery.
From: wod-ga on 14 Mar 2003 00:50 PST
 
well.. there are some ways but none are efficient. SHOULD use is a
vague concept. Who is to say what server he SHOULD use ? define
"SHOULD USE" and you'll have your answer. You can, for instance, dig
the DNS for the ISP's MX records. But some ISPs will throw a hissy fit
if you don't use what they TELL you to use. So it's up to you.. it's
possible, but it might get you in a load of trouble.
Subject: Re: SMTP server discovery.
From: asterisk_man-ga on 14 Mar 2003 08:44 PST
 
Why bother using the user's SMTP server? Why not just go to the
destination directly? If you know the destination hostname (ex.
hotmail.com) you can do a DNS lookup for the MX record which will tell
you the hostnames for the SMTP servers that accept mail for users with
addresses in the hotmail.com domain (ex. joe@hotmail.com). If you then
communicate directly with the destination SMTP server you won't need
to worry about what server the user's ISP tells them to use. After
all, they use a single SMTP server to make things easier on them,
nothing says that you can't just do the first step of the routing for
them. In effect what I am saying is that instead of determining their
ISP SMTP server use the one for the reciepient of the email and
everything else should go just as it would have with the ISP SMTP.
Does this sound like it would work? If not, why? I've essentially done
this myself in the past and had no trouble with it.
Good luck.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy