FAQ
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%) 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.htm>

Search Discussions

  • Kev Dwyer at Nov 21, 2009 at 5:04 pm
    On Sat, 21 Nov 2009 08:19:52 -0500, Victor Subervi wrote:

    Hello Victor,

    The information that you have sent comes from the client side of the
    transaction, so it isn't possible to tell why the server disconnected.
    Assuming that there is an SMTP server listening on port 25, you need to
    check the SMTP server logs. You might need to crank up the logging to
    get useful output.

    If the information that you pasted in comes from a Django traceback then
    you could check the Django page on e-mail at
    http://docs.djangoproject.com/en/dev/topics/email/#topics-email
    (dev version, you might need to view an older version).

    Cheers,

    Kev
  • Victor Subervi at Nov 21, 2009 at 5:27 pm

    On Sat, Nov 21, 2009 at 12:04 PM, Kev Dwyer wrote:

    On Sat, 21 Nov 2009 08:19:52 -0500, Victor Subervi wrote:

    Hello Victor,

    The information that you have sent comes from the client side of the
    transaction, so it isn't possible to tell why the server disconnected.
    Assuming that there is an SMTP server listening on port 25, you need to
    check the SMTP server logs.

    There wasn't anything in /var/log/maillog. Is that where I should have
    checked?

    You might need to crank up the logging to
    get useful output.
    How?
    Look at the output below:

    [root at 13gems stcroixresort]# netstat -tulp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address
    State PID/Program name
    tcp 0 0 *:mysql *:*
    LISTEN 24488/mysqld
    tcp 0 0 *:pop3 *:*
    LISTEN 5278/tcpserver
    tcp 0 0 *:ftp *:*
    LISTEN 26564/vsftpd
    tcp 0 0 localhost.localdomai:domain *:*
    LISTEN 11845/named
    tcp 0 0 *:smtp *:*
    LISTEN 5274/tcpserver
    tcp 0 0 localhost.localdomain:rndc *:*
    LISTEN 11845/named
    tcp 0 0 *:http *:*
    LISTEN 5201/httpd
    tcp 0 0 localhost:domain *:*
    LISTEN 11845/named
    tcp 0 0 *:ssh *:*
    LISTEN 15509/sshd
    tcp 0 0 localhost:rndc *:*
    LISTEN 11845/named
    udp 0 0 localhost.locald:domain
    *:* 11845/named
    udp 0 0 localhost:domain
    *:* 11845/named
    [root at 13gems stcroixresort]# qmailctl stat
    /service/qmail-send: up (pid 5266) 594565 seconds
    /service/qmail-send/log: up (pid 5271) 594565 seconds
    /service/qmail-smtpd: up (pid 5274) 594565 seconds
    /service/qmail-smtpd/log: up (pid 5276) 594565 seconds
    /service/qmail-pop3d: up (pid 5278) 594565 seconds
    /service/qmail-pop3d/log: up (pid 5279) 594565 seconds
    messages in queue: 0
    messages in queue but not yet preprocessed: 0

    Please advise.
    TIA,
    V
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20091121/53d5d075/attachment.htm>
  • Kev Dwyer at Nov 21, 2009 at 6:16 pm
    2009/11/21 Victor Subervi <victorsubervi at gmail.com>
    On Sat, Nov 21, 2009 at 12:04 PM, Kev Dwyer wrote:

    On Sat, 21 Nov 2009 08:19:52 -0500, Victor Subervi wrote:

    Hello Victor,

    The information that you have sent comes from the client side of the
    transaction, so it isn't possible to tell why the server disconnected.
    Assuming that there is an SMTP server listening on port 25, you need to
    check the SMTP server logs.

    There wasn't anything in /var/log/maillog. Is that where I should have
    checked?

    You might need to crank up the logging to
    get useful output.
    How?
    Look at the output below:

    [root at 13gems stcroixresort]# netstat -tulp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign Address
    State PID/Program name
    tcp 0 0 *:mysql *:*
    LISTEN 24488/mysqld
    tcp 0 0 *:pop3 *:*
    LISTEN 5278/tcpserver
    tcp 0 0 *:ftp *:*
    LISTEN 26564/vsftpd
    tcp 0 0 localhost.localdomai:domain *:*
    LISTEN 11845/named
    tcp 0 0 *:smtp *:*
    LISTEN 5274/tcpserver
    tcp 0 0 localhost.localdomain:rndc *:*
    LISTEN 11845/named
    tcp 0 0 *:http *:*
    LISTEN 5201/httpd
    tcp 0 0 localhost:domain *:*
    LISTEN 11845/named
    tcp 0 0 *:ssh *:*
    LISTEN 15509/sshd
    tcp 0 0 localhost:rndc *:*
    LISTEN 11845/named
    udp 0 0 localhost.locald:domain
    *:* 11845/named
    udp 0 0 localhost:domain
    *:* 11845/named
    [root at 13gems stcroixresort]# qmailctl stat
    /service/qmail-send: up (pid 5266) 594565 seconds
    /service/qmail-send/log: up (pid 5271) 594565 seconds
    /service/qmail-smtpd: up (pid 5274) 594565 seconds
    /service/qmail-smtpd/log: up (pid 5276) 594565 seconds
    /service/qmail-pop3d: up (pid 5278) 594565 seconds
    /service/qmail-pop3d/log: up (pid 5279) 594565 seconds
    messages in queue: 0
    messages in queue but not yet preprocessed: 0

    Please advise.
    TIA,
    V
    Hello Victor,

    I'm afraid I don't know much about mail servers, you need to check the
    server docs or ask on a qmail mailing list.

    If you really think this is a python issue, then you could try:
    import smtplib
    server = smtplib.SMTP()
    server.set_debuglevel(1)
    server.connect()
    connect: ('localhost', 25)
    connect: (25, 'localhost')
    reply: '220 pluto.site ESMTP Postfix\r\n'
    reply: retcode (220); Msg: pluto.site ESMTP Postfix
    connect: pluto.site ESMTP Postfix
    (220, 'pluto.site ESMTP Postfix')
    server.quit()
    send: 'quit\r\n'
    reply: '221 2.0.0 Bye\r\n'
    reply: retcode (221); Msg: 2.0.0 Bye
    (221, '2.0.0 Bye')


    and see if there are any error messages/tracebacks in the output; but if you
    still get a disconnect exception then it's unlikely that this is a python
    issue.

    Cheers,

    Kev
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20091121/cfe9b066/attachment-0001.htm>
  • Victor Subervi at Nov 21, 2009 at 6:59 pm

    On Sat, Nov 21, 2009 at 1:16 PM, Kev Dwyer wrote:
    2009/11/21 Victor Subervi <victorsubervi at gmail.com>
    On Sat, Nov 21, 2009 at 12:04 PM, Kev Dwyer wrote:

    On Sat, 21 Nov 2009 08:19:52 -0500, Victor Subervi wrote:

    Hello Victor,

    The information that you have sent comes from the client side of the
    transaction, so it isn't possible to tell why the server disconnected.
    Assuming that there is an SMTP server listening on port 25, you need to
    check the SMTP server logs.

    There wasn't anything in /var/log/maillog. Is that where I should have
    checked?

    You might need to crank up the logging to
    get useful output.
    How?
    Look at the output below:

    [root at 13gems stcroixresort]# netstat -tulp
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address Foreign
    Address State PID/Program name
    tcp 0 0 *:mysql
    *:* LISTEN 24488/mysqld
    tcp 0 0 *:pop3
    *:* LISTEN 5278/tcpserver
    tcp 0 0 *:ftp
    *:* LISTEN 26564/vsftpd
    tcp 0 0 localhost.localdomai:domain
    *:* LISTEN 11845/named
    tcp 0 0 *:smtp
    *:* LISTEN 5274/tcpserver
    tcp 0 0 localhost.localdomain:rndc
    *:* LISTEN 11845/named
    tcp 0 0 *:http
    *:* LISTEN 5201/httpd
    tcp 0 0 localhost:domain
    *:* LISTEN 11845/named
    tcp 0 0 *:ssh
    *:* LISTEN 15509/sshd
    tcp 0 0 localhost:rndc
    *:* LISTEN 11845/named
    udp 0 0 localhost.locald:domain
    *:* 11845/named
    udp 0 0 localhost:domain
    *:* 11845/named
    [root at 13gems stcroixresort]# qmailctl stat
    /service/qmail-send: up (pid 5266) 594565 seconds
    /service/qmail-send/log: up (pid 5271) 594565 seconds
    /service/qmail-smtpd: up (pid 5274) 594565 seconds
    /service/qmail-smtpd/log: up (pid 5276) 594565 seconds
    /service/qmail-pop3d: up (pid 5278) 594565 seconds
    /service/qmail-pop3d/log: up (pid 5279) 594565 seconds
    messages in queue: 0
    messages in queue but not yet preprocessed: 0

    Please advise.
    TIA,
    V
    Hello Victor,

    I'm afraid I don't know much about mail servers, you need to check the
    server docs or ask on a qmail mailing list.

    If you really think this is a python issue, then you could try:
    import smtplib
    server = smtplib.SMTP()
    server.set_debuglevel(1)
    server.connect()
    connect: ('localhost', 25)
    connect: (25, 'localhost')
    reply: '220 pluto.site ESMTP Postfix\r\n'
    reply: retcode (220); Msg: pluto.site ESMTP Postfix
    connect: pluto.site ESMTP Postfix
    (220, 'pluto.site ESMTP Postfix')
    server.quit()
    send: 'quit\r\n'
    reply: '221 2.0.0 Bye\r\n'
    reply: retcode (221); Msg: 2.0.0 Bye
    (221, '2.0.0 Bye')


    and see if there are any error messages/tracebacks in the output; but if
    you still get a disconnect exception then it's unlikely that this is a
    python issue.
    Thank you. Yes, there was an error.
    V
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20091121/2eaa02bd/attachment.htm>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedNov 21, '09 at 1:19p
activeNov 21, '09 at 6:59p
posts5
users2
websitepython.org

2 users in discussion

Victor Subervi: 3 posts Kev Dwyer: 2 posts

People

Translate

site design / logo © 2022 Grokbase