I'm planning to write an application that should handle incoming mails. Basically it will act more like a ticketing system than a webmail, so I'm only interested in receiving emails, and not sending them.
I have made a simple prototype that downloads mails and displays the text with downloadable attachments in a web page, but handling mails from Outlook and others is more complicated. I have looked at some of the open source ticketing systems out there, but most of the code is tied to the system and is hard to separate.
Is there a library that understands "rich" mail and makes this job simpler? Preferably in Python, Java, Ruby or Perl. I'm also open to suggestions for any command line mail clients that can be used for this, since the system will not receive large amounts of mail and can afford to launch external processes.
Edit:
I know about the standard mail libraries in Python and Java and can handle the mail itself, but I'm looking for a library that can help me with the "rich" emails created by Outlook/Thunderbird that contains formatting and inline images.