Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

smtp debugging methods

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


seannakasone at yahoo

Sep 14, 2007, 3:21 AM

Post #1 of 4 (278 views)
Permalink
smtp debugging methods

I'm having trouble with sending smtp mail. It's hanging after the
smtplib.SMTP() line. It doesn't works from home but not from work. What's
the best way to debug this?

# Here's my script
import smtplib
msg = "Subject: Hello\n\nThis is the\nbody of the message."
server = smtplib.SMTP("smtp.gmail.com",465)
# "Connection refused" normally means there is no server listening for
# connections on the specified IP/port-combination.
# use netstat -an to view connections.
server.set_debuglevel(1)
server.ehlo()
server.starttls()
server.ehlo()
# !!! set the password
server.login("myuser", "mypass")
server.sendmail("...

# Here's the error
>>> server = smtplib.SMTP("smtp.gmail.com",465)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/smtplib.py", line 241, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python2.4/smtplib.py", line 304, in connect
(code, msg) = self.getreply()
File "/usr/lib/python2.4/smtplib.py", line 345, in getreply
line = self.file.readline()
File "/usr/lib/python2.4/socket.py", line 340, in readline
data = self._sock.recv(self._rbufsize)
socket.error: (113, 'Software caused connection abort')
--
http://mail.python.org/mailman/listinfo/python-list


jon+usenet at unequivocal

Sep 14, 2007, 3:32 AM

Post #2 of 4 (248 views)
Permalink
Re: smtp debugging methods [In reply to]

On 2007-09-14, Sean Nakasone <seannakasone [at] yahoo> wrote:
> I'm having trouble with sending smtp mail. It's hanging after the
> smtplib.SMTP() line. It doesn't works from home but not from work. What's
> the best way to debug this?
>
> # Here's the error
>>>> server = smtplib.SMTP("smtp.gmail.com",465)

smtp.gmail.com port 465 is SSL only. Try port 587 instead.
--
http://mail.python.org/mailman/listinfo/python-list


tim at tdw

Sep 14, 2007, 3:35 AM

Post #3 of 4 (243 views)
Permalink
Re: smtp debugging methods [In reply to]

On 14/09/2007, Sean Nakasone <seannakasone [at] yahoo> wrote:
> I'm having trouble with sending smtp mail. It's hanging after the
> smtplib.SMTP() line. It doesn't works from home but not from work. What's
> the best way to debug this?
>
> # Here's my script
> import smtplib
> msg = "Subject: Hello\n\nThis is the\nbody of the message."
> server = smtplib.SMTP("smtp.gmail.com",465)
> # "Connection refused" normally means there is no server listening for
> # connections on the specified IP/port-combination.
> # use netstat -an to view connections.
> server.set_debuglevel(1)
> server.ehlo()
> server.starttls()
> server.ehlo()
> # !!! set the password
> server.login("myuser", "mypass")
> server.sendmail("...
>
> # Here's the error
> >>> server = smtplib.SMTP("smtp.gmail.com",465)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.4/smtplib.py", line 241, in __init__
> (code, msg) = self.connect(host, port)
> File "/usr/lib/python2.4/smtplib.py", line 304, in connect
> (code, msg) = self.getreply()
> File "/usr/lib/python2.4/smtplib.py", line 345, in getreply
> line = self.file.readline()
> File "/usr/lib/python2.4/socket.py", line 340, in readline
> data = self._sock.recv(self._rbufsize)
> socket.error: (113, 'Software caused connection abort')

There is no SMTP service on port 465 , its some other "service" or the
smtp server is in trouble, try it with port 587 instead.

HTH :)
--
http://mail.python.org/mailman/listinfo/python-list


timr at probo

Sep 14, 2007, 11:05 PM

Post #4 of 4 (233 views)
Permalink
Re: smtp debugging methods [In reply to]

Sean Nakasone <seannakasone [at] yahoo> wrote:
>
>I'm having trouble with sending smtp mail. It's hanging after the
>smtplib.SMTP() line. It doesn't works from home but not from work. What's
>the best way to debug this?

It's quite possible that your network at work has a firewall blocking these
ports. Many employers allow outgoing connections only on ports 25, 80, and
443.
--
Tim Roberts, timr [at] probo
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.