Problem w/ smtplib
Victor Subervi
victorsubervi at gmail.com
Sat Nov 21 08:19:52 EST 2009
Hi;
I get the following error:
/var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py 52
session.sendmail(clientEmail, ourEmail1, header+msg)
53 # session.sendmail(clientEmail, ourEmail2, header+msg)
54
55 mailSpreadsheet()
56
*mailSpreadsheet* = <function mailSpreadsheet>
/var/www/html/globalsolutionsgroup.vi/mailSpreadsheet.py in *mailSpreadsheet
*() 47 order += 'TOTAL: $' + str(total)
48
msg = 'Here is the order from %s:\n\n %s' % (string.replace(client,
'_', ' '), order)
49 session = smtplib.SMTP("localhost")
50 session.login(user, passwd) # only if it requires auth
51
header = "Subject: %s \r\nContent-type: text/html;
charset=utf-8\r\n\r\n" % subject
session *undefined*, *global* *smtplib* = <module 'smtplib' from
'/usr/lib64/python2.4/smtplib.pyc'>, smtplib.*SMTP* = <class smtplib.SMTP>
/usr/lib64/python2.4/smtplib.py in *__init__*(self=<smtplib.SMTP instance>,
host='localhost', port=0, local_hostname=None) 242
self.esmtp_features = {}
243 if host:
244 (code, msg) = self.connect(host, port)
245 if code != 220:
246 raise SMTPConnectError(code, msg)
code *undefined*, msg *undefined*, *self* = <smtplib.SMTP instance>, self.*
connect* = <bound method SMTP.connect of <smtplib.SMTP instance>>, *host* =
'localhost', *port* = 0 /usr/lib64/python2.4/smtplib.py in
*connect*(self=<smtplib.SMTP
instance>, host='localhost', port=25) 305 if not self.sock:
306 raise socket.error, msg
307 (code, msg) = self.getreply()
308 if self.debuglevel > 0: print>>stderr, "connect:", msg
309 return (code, msg)
code *undefined*, *msg* = 'getaddrinfo returns an empty list', *self* =
<smtplib.SMTP instance>, self.*getreply* = <bound method SMTP.getreply of
<smtplib.SMTP instance>> /usr/lib64/python2.4/smtplib.py in
*getreply*(self=<smtplib.SMTP
instance>) 349 if line == '':
350 self.close()
351
raise SMTPServerDisconnected("Connection unexpectedly closed")
352
if self.debuglevel > 0: print>>stderr, 'reply:', repr(line)
353 resp.append(line[4:].strip())
*global* *SMTPServerDisconnected* = <class smtplib.SMTPServerDisconnected>*
SMTPServerDisconnected*: Connection unexpectedly closed
args = ('Connection unexpectedly closed',)
Why did this connection close? How do I fix it? I tried commenting out the
authentication line. I have imported smtplib.
TIA,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091121/0dc79a36/attachment.html>
More information about the Python-list
mailing list