Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I wanted to ask if there's a recommended library that parses eml files, but doesn't parse the attachments?

i want to be able to construct email messages from it, without attachments, and later, with another job - extract the attachments.

thanks
Posted
Comments
Sergey Alexandrovich Kryukov 5-Aug-12 17:47pm    
What does it mean "parse eml file"? If it "does not parse the attachments", what it does?
--SA

1 solution

"EML" is nothing more then a usual convention on the file names used by many e-mail applications and some Web browsers (like Mozilla Seamonkey suite which does not use it in its e-mail application but view them). Those files do not have any special file format. The simply have all the data which is contained in the e-mail message, as a package sent and received by Mail Delivery agents (http://en.wikipedia.org/wiki/Mail_delivery_agent[^]), POP3, IMAP servers, etc.

If you simply open this file with a text editor, you will have a pretty good idea what's in it: headers and, optionally, some "parts", in a multipart messages. You might wish that some of the parts could be presented to you in a more human-readable form, such as HTML, but you did not tell us what would you like to do with it.

If try to find "attachment", you will see that there is nothing which is "attached"; an attachment is merely yes another message part embedded in the message (so I don't know why it was called "attachment", perhaps by some historical reasons) with "Content-disposition: attachment" and optionally, a file name:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html[^].

Basically, it is designed to include arbitrary file in arbitrary formats. E-mail programs usually offers a possibility to "save" them as separate files. I wonder what would you mean by parsing them, so not parsing "attachments" is probably the only reasonable option.

To parse a message into its components, try to use this MailUtilities library:
http://mailutilities.codeplex.com/[^].

—SA
 
Share this answer
 
Comments
arielbeck 6-Aug-12 2:19am    
I already know all those,
i just don't want to parse it myself. (if there's no way, i'll do that, and remove the base-64 attachment part).
Sergey Alexandrovich Kryukov 6-Aug-12 12:03pm    
Very good, it's just was not apparent from your question. Did you look at the Mail Utilities referenced above?
--SA
arielbeck 15-Aug-12 14:56pm    
not yet, we decided not to work on the "attachments outside", and we will probably do it sometime in the future
Sergey Alexandrovich Kryukov 15-Aug-12 15:19pm    
I don't know what is an "attachment outside", but I answered your question. Please consider accepting it formally (green button) -- thanks.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900