help with parsing email

Werner F. Bruhin werner.bruhin at free.fr
Mon Aug 18 13:04:21 EDT 2008


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




More information about the Python-list mailing list