Python Smtplib.py - address family not supported
Posted in General on October 19th, 2006
python 2.3.3; smtplib stopped working when sending to localhost. This broke my mailman installation for a day or two.
It turned out the hostname of my server mx.askerrol.org, was being set to mx only and could not be resolved; so SMTPlib failed.
I had to modify /etc/nodename, even though /etc/hostname.DEVICE and /etc/hosts had the FQDN.
Once this was done, everything started working properly. Thanks go to the folks on the freenode.net #python channel for the assistance in debugging this.
Message length is 60
connect: (‘127.0.0.1′, 25)
connect:(‘127.0.0.1′, 25)
reply: ‘220 mx.askerrol.org ESMTP Postfix\r\n’
reply: retcode (220);
Msg: mx.askerrol.org ESMTP Postfix
connect: mx.askerrol.org ESMTP Postfix
Traceback(most recent call last): File “test1.py”, line 24, in ? server = smtplib.SMTP(‘127.0.0.1′)
File“/usr/local/lib/python2.3/smtplib.py”, line 254, in __init__ addr =socket.gethostbyname(socket.gethostname()) socket.gaierror: (1, ‘address family not supported’)