Hello
It really depends on your environment.
You can do that:
- on the mail server side (ex: | in postfix config that lead to your script)
- with polling on imap or pop accounts with an appropriate client (PoCo::Client::POP3 or Net::IMAP::Simple)
- by parsing your Outlook inbox with Win32::OLE (what makes me think you are using Outlook ?)
- by using WWW::Mechanize or WWW::Hotmail or WWW::GMail eventually to read emails thru webmails
all this untested (except Net::IMAP::Simple actually that I've been using to pull emails from imap mailboxes once in a while).
good luck and should you need clarifications please be more detailled in youre requirements