views:

480

answers:

2

Hi, I need to extract the images (attached) of a .EML file. Any help or ideas? Thanks in advance. (I'm programming in c#)

+1  A: 

If you really mean .eml (a file containing contents mime-encoded message), take a look at some of MIME implementations for your language, for instance, http://www.codeproject.com/KB/cs/MIME_De_Encode_in_C_.aspx or http://anmar.eu.org/projects/sharpmimetools/

naivists
A: 

There is an Extract Attachments sample which shows how to solve exactly this task using our Rebex Mail component.

// Load mail message from disk 
MailMessage mail = new MailMessage ();
mail.Load (args[0]);

Console.WriteLine ("Message contains {0} attachments.", mail.Attachments.Count);

// If message has no attachments, just exit 
if (mail.Attachments.Count == 0)
 return 0;

foreach (Attachment attachment in mail.Attachments)
{
 // Save the file 
 Console.WriteLine ("Saving '{0}' ({1}).", 
 attachment.FileName, attachment.MediaType);
 attachment.Save (attachment.FileName);
}
Martin Vobr