AppleSingle | Blog | Limilabs https://www.limilabs.com/blog Tue, 09 Sep 2014 15:55:49 +0000 en-US hourly 1 https://wordpress.org/?v=6.3.4 Processing applesingle and appledouble email attachments https://www.limilabs.com/blog/applesingle-appledouble-email-attachments Wed, 01 Oct 2014 15:08:18 +0000 http://www.limilabs.com/blog/?p=4804 Mail.dll now supports applesingle and appledouble email attachments. AppleSingle and AppleDouble are file formats developed to store Mac OS “dual-forked” files (data fork and resource fork) AppleSingle combines both file forks and the related Finder meta-file information into a single file MIME entity, usually with application/applesingle content-type email header. Applesingle files are parsed by Mail.dll […]

The post Processing applesingle and appledouble email attachments first appeared on Blog | Limilabs.

]]>
Mail.dll now supports applesingle and appledouble email attachments.

AppleSingle and AppleDouble are file formats developed to store Mac OS “dual-forked” files (data fork and resource fork)

AppleSingle combines both file forks and the related Finder meta-file information into a single file MIME entity, usually with application/applesingle content-type email header. Applesingle files are parsed by Mail.dll and data fork is extracted as a standard email attachment available through IMail.Attachments collection.

AppleDouble stores both forks as two separate files. Thus it uses multipart mime type – inside two MIME entities are stored: application/applefile, which contains resource fork only, and regular MIME attachment e.g. application/octet-stream content-type.

In both cases you simply use IMail.Attachments collection to access attachments.

byte[] eml = ...;

IMail mail = new MailBuilder().CreateFromEml(eml);
Assert.AreEqual(1, mail.Attachments.Count);
MimeData att = (MimeData) mail.Attachments[0];

byte[] data = att.Data; // data fork

You can control, if apple attachments should be processed using MailBuilder.ProcessAppleAutomatically property. When it is set to false applesingle files are not parsed and data fork is not extracted.

byte[] eml = ...;

MailBuilder builder = new MailBuilder();
builder.ProcessBinHexAutomatically = false;
IMail mail = builder.CreateFromEml(eml);

MimeAppleSingle appleSingle = (MimeAppleSingle) mail.Attachments[0];

Assert.AreEqual(ContentType.ApplicationAppleSingle, appleSingle.ContentType);

byte[] resource = appleSingle.AppleSingle.Resources;
string name = appleSingle.AppleSingle.RealName;

The post Processing applesingle and appledouble email attachments first appeared on Blog | Limilabs.

]]>