Python Will Not Send Email!!

Victor Subervi victorsubervi at gmail.com
Fri Nov 20 18:39:30 CET 2009


On Fri, Nov 20, 2009 at 12:38 PM, Carsten Haese <carsten.haese at gmail.com>wrote:

> Thank you. This proves conclusively that there IS in fact a file called
> email.pyc (and/or email.py) in your directory next to testMail.py. It is
> this email.pyc that is being imported instead of the email.py from the
> Python library. Getting rid of both email.py and email.pyc (by renaming
> them, deleting them, or moving them somewhere else) will fix your problem.
>

Thank you! It did indeed fix that problem. Now I get this traceback:

 /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?
TIA,
V
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091120/3e132578/attachment.html>


More information about the Python-list mailing list