[python-win32] help with parsing email
Mike Driscoll
mdriscoll at co.marshall.ia.us
Tue Aug 19 16:24:39 CEST 2008
Ahmed, Shakir wrote:
> -----Original Message-----
> From: python-list-bounces+shahmed=wmd.gov at python.org
> [mailto:python-list-bounces+shahmed=wmd.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 =oplib.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 =oplib.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 =oplib.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 =oplib.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')
>
>
>
Some POP3 servers require secure connections too. I've dealt with one
that had TLS enabled, so I had to use an external TLS Python module to
connect to it. I would check Outlook's settings and see if it has SSL or
TLS enabled.
For more information, see:
http://www.python.org/doc/lib/module-poplib.html
http://trevp.net/tlslite/
-------------------
Mike Driscoll
Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org
More information about the python-win32
mailing list