[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: Recieving emails in python

Shane Geiger

1/14/2008 6:54:00 AM

mobiledreamers@gmail.com wrote:
> I m trying to create something simple a mailing list similar to yahoo
> groups
> I m stumbling at the part where the python recieves messages via say
> python@yahoogroups.com <mailto:python@yahoogroups.com>
>
> how to make python recieve emails and process it
> after that it is straight forward processing in python inserting in db etc

Can you use POP to access Yahoo groups?

If so, this script will get you started:

#!/usr/bin/python
"""
Redirect the output to a file to capture the contents of the mailbox.
"""
host = 'foo.com'
account = 'jennyjenny'
password = '8675309'

import getpass, poplib
M = poplib.POP3(host)
#M.user(getpass.getuser())
#M.pass_(getpass.getpass())
M.user(account)
M.pass_(password)
numMessages = len(M.list()[1])
for i in range(numMessages):
for j in M.retr(i+1)[1]:
print j



--
Shane Geiger
IT Director
National Council on Economic Education
sgeiger@ncee.net | 402-438-8958 | http://ww...

Leading the Campaign for Economic and Financial Literacy