Does smtplib lookup MX records?

Lad export at sendme.cz
Sat Nov 17 03:50:00 EST 2001


Just van Rossum <just at letterror.com> wrote in message news:<3BF56916.8834B8D7 at letterror.com>...
> Dale Strickland-Clark wrote:
> 
> > I've been trying to send emails with smtplib and had a large number of
> > failures. Investigation seems to reveal the the smtplib module does a
> > simple connect passing the hostname to socket.connect without trying
> > to resolve the MX record.
> > 
> > In some cases this works where the mail server happens to have an
> > A-type DNS record anyway but otherwise it fails with a connection
> > error.
> > 
> > Is this really the case?
> > 
> > If it is, what do I need to do to lookup the MX record myself?
> > 
> > (This is rather urgent now as this program was hastily written to help
> > a client out who's mail server has died.)
> 
> Are you sure you're using smtplib correctly? I *think* it's mostly meant
> to talk to a local relay host (eg. smtp.my-isp.com). The smtp server
> will take care of the rest. If you insist on delivering yourself, then
> yeah, you'd have to look up the mx record for each recipient, but I
> wouldn't consider that typical usage of smtplib. Am I missing something?
> 
> Just

If you use windows you can use , for MX records lookup, 
http://www.internext.co.za/stefan/aspmx/aspmx.zip
It works well.
Ladislav



More information about the Python-list mailing list