Popmail.py Need help.....................

Peter Hansen peter at engcorp.com
Thu Aug 9 07:02:11 CEST 2001

Relfx wrote:
> I have tried using these modules but i'm getting some errors when i run the
> script.
> M = poplib.POP3('pop.mail.mia.bellsouth.net')

> >>>
> Traceback (most recent call last):
>   File "<string>", line 1, in ?
>   File "C:\Python21\Scripts\popmail.py", line 2, in ?
>     M = poplib.POP3('pop.mail.mia.bellsouth.net')
>   File "C:\PYTHON21\lib\poplib.py", line 79, in __init__
>     self.sock.connect((self.host, self.port))
>   File "<string>", line 1, in connect
> error: host not found

"Host not found" should tell you something.  It's not the
script that's the problem, it's the address you are using.

pop.mail.mia.bellsouth.net does not exist.

Try just mail.bellsouth.net, or mia.bellsouth.net, or
even mail.mia.bellsouth.net.

When attempting to debug network applications, you should
learn to use several handy-dandy tools for troubleshooting.

First try ping.  If that doesn't work, don't waste your
time trying to connect to the other host (unless it
is hiding behind a firewall, in which case you need to 
know a lot more about networking and such before you 
attempt this stuff).

Another one is 'host', if you're on Unix.  This will 
attempt to look up the IP address of the named host
in your DNS and report it.  You can also look into
'nslookup' or the newer 'dig'.

Next, if you can see the host with ping, try using telnet.
Telnet allows you to establish a "raw" TCP connection to 
an arbitrary port on a host.  If you can't connect with
telnet, you're wasting your time trying to connect with
HTTP, POP, SMTP, or any of a hundred other standard
TCP protocols.

$ telnet mail.bellsouth.net 110

+OK InterMail POP3 server ready.
user guest
+OK please send PASS command
pass password
-ERR invalid user name or password.
-ERR Invalid command; valid commands: USER, QUIT
+OK guest InterMail POP3 server signing off.

(The things with + and - are the responses from 
the Bellsouth POP3 server.  The rest is what 
I typed.)

Peter Hansen, P.Eng.
peter at engcorp.com

More information about the Python-list mailing list