[web2py] Re: Read file attached from gmail
>Every day i did received a email (gmail) with a file attached (text) as rar. >My question is how i can read this file attached from web2py? Try this (this recipe is for the last adapter modifications in trunk): # Connect to the IMAP service with web2py # For Gmail the connection string should be # "imap://youracco...@gmail.com:passw...@imap.gmail.com:993" imapdb = DAL("imap://account@domain:password@imapserver:port", pool_size=1) # To fetch today's emails from a given sender: # Note: your mailbox can have a different name. # The complete mailbox tablenames can be retrieved with imapdb.tables() # The actual mailbox name is in imapdb.TABLE.mailbox emails = imapdb((imapdb.INBOX.created>=request.now.date())&\ (imapdb.INBOX.sender.contains("sender@mail.account"))).select() # Loop for processing any mail attachments for email in emails: # The email attachments (if any) are accessible with # email.attachments (a list with the attachment data ... --
[web2py] Re: Read file attached from gmail
check this: http://stackoverflow.com/questions/8307809/save-email-attachment-python3-pop3-ssl-gmail On Tuesday, September 18, 2012 2:53:35 AM UTC+4:30, visuallinux wrote: > > Dear All. > > Every day i did received a email (gmail) with a file attached (text) as > rar. > > My question is how i can read this file attached from web2py? > > Or how i can download this file to /tmp folder? > > Any idea. > > Regards > > > > > > --