Does smtplib lookup MX records?

Dale Strickland-Clark dale at
Fri Nov 16 17:45:33 CET 2001

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

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.)

Dale Strickland-Clark
Riverhall Systems Ltd

More information about the Python-list mailing list