471,353 Members | 1,686 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,353 software developers and data experts.

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')
Sep 14 '07 #1
3 5107
On 2007-09-14, Sean Nakasone <se**********@yahoo.comwrote:
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.
Sep 14 '07 #2
On 14/09/2007, Sean Nakasone <se**********@yahoo.comwrote:
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 :)
Sep 14 '07 #3
Sean Nakasone <se**********@yahoo.comwrote:
>
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, ti**@probo.com
Providenza & Boekelheide, Inc.
Sep 15 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Christian Patterer | last post: by
7 posts views Thread by William Case | last post: by
5 posts views Thread by R. Ian Lee | last post: by
4 posts views Thread by z f | last post: by
2 posts views Thread by zubair | last post: by
232 posts views Thread by robert maas, see http://tinyurl.com/uh3t | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.