On Wed, Jan 12, 2011 at 10:59 AM, Matty Sarro <msa...@gmail.com> wrote: > As of now here is my situation: > I am working on a system to aggregate IT data and logs. A number of > important data are gathered by a third party system. The only > immediate way I have to access the data is to have their system > automatically email me updates in CSV format every hour. If I set up a > mail client on the server, this shouldn't be a huge issue. > > However, is there a way to automatically open the emails, and copy the > attachments to a directory based on the filename? Kind of a weird > project, I know. Just looking for some ideas hence posting this on two > lists.
Parsing out email attachments: http://docs.python.org/library/email.parser.html http://docs.python.org/library/email.message.html#module-email.message Parsing the extension from a filename: http://docs.python.org/library/os.path.html#os.path.splitext Retrieving email from a mail server: http://docs.python.org/library/poplib.html http://docs.python.org/library/imaplib.html You could poll for new messages via a cron job or the `sched` module (http://docs.python.org/library/sched.html ). Or if the messages are being delivered locally, you could use inotify bindings or similar to watch the appropriate directory for incoming mail. Integration with a mail server itself is also a possibility, but I don't know much about that. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list