help with parsing email

Ahmed, Shakir shahmed at sfwmd.gov
Mon Aug 18 13:42:03 EDT 2008



-----Original Message-----
From: python-list-bounces+shahmed=sfwmd.gov at python.org
[mailto:python-list-bounces+shahmed=sfwmd.gov at python.org] On Behalf Of
Werner F. Bruhin
Sent: Monday, August 18, 2008 1:04 PM
To: python-list at python.org
Cc: python-win32 at python.org
Subject: Re: help with parsing email

Ahmed, Shakir wrote:
> Thanks everyone who tried to help me to parse incoming email from an
exchange server:
> 
> Now, I am getting following error; I am not sure where I am doing
wrong. I appreciate any help how to resolve this error and extract
emails from an exchange server. 
> 
> 
> First I tried:
>>>> mailserver = 'EXCHVS01.my.org'
>>>> mailuser = 'myname'
>>>> mailpasswd = 'mypass'
>>>> mailserver = poplib.POP3(mailserver)
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
>   File "C:\Python24\lib\poplib.py", line 96, in __init__
>     raise socket.error, msg
> error: (10061, 'Connection refused')
> 
> 
> 
> The other way:
> 
>>>> mailserver = 'pop.EXCHVS01.ad.my.org'
>>>> mailuser = 'myname at my.org'
>>>> mailpasswd = 'mypass'
>>>> mailserver = poplib.POP3(mailserver)
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
>   File "C:\Python24\lib\poplib.py", line 84, in __init__
>     for res in socket.getaddrinfo(self.host, self.port, 0,
socket.SOCK_STREAM):
> gaierror: (11001, 'getaddrinfo failed')
Haven't used poplib myself, but was intrigued.

Did you see this:
http://www.python.org/doc/lib/pop3-example.html

To me it looks like you are not setting the user/password.

So, maybe something like:

M = poplib.POP3(mailserver)
M.user(mailuser)
M.pass_(mailpasswd)
....

Werner

--

but I am getting error before that point and could not go to the user
account or pass.

M = poplib.POP3(mailserver)
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\lib\poplib.py", line 96, in __init__
    raise socket.error, msg
error: (10061, 'Connection refused')





More information about the Python-list mailing list