views:

127

answers:

5

I have an application and need to write a program that is able to figure out attachments from all kinds of email senders (and MUAs) reliably. PHP doesn't seem to have a great MIME parser so I was hoping some other languages might.

I've seen the PHP Mail Mime Parser but it's not robust at all and I know (and have confirmed) it doesn't work reliably with all MUAs.

Does anyone know of a more real-world-hardened mail parsing library?

I can use any language, doesn't matter.

+4  A: 

How about Perl 5's Email::MIME? Looks like something that will fulfill Your needs, if I understood You correctly.

tadzik
A: 

I've had some luck with the eZ Components mail library for PHP before.

tabacco
+3  A: 

Python's email module is excellent and includes full support for MIME emails, including incremental parsing. I think the moral here is that you can do this in many languages.

Of course, you should do it in Python.

katrielalex
+3  A: 

Perl has several email parsing libraries, choose the one which suits your needs best.

redhotpenguin
A: 

I have had a lot of success using Ruby and the mail gem at http://github.com/mikel/mail this is now the default creator/parser for Rails.

I think you are really going to get answers from people with their preference of language so I think its ultimately a question of preference but we use this gem in the web front end of CloudMailin.

Steve Smith