Click to See Complete Forum and Search --> : Wanted: MIME Decoder


rflagg
June 12th, 2002, 06:07 PM
I'm looking for C# code that has a MIME decoder.

Anyone?


rflagg

AlenT
June 18th, 2002, 12:38 PM
Try this code in C# to convert base64-encoded text (FromBase64Transform class can be found in System.Security.Cryptography namespace)

FromBase64Transform transformer = new FromBase64Transform();
byte[] byteData = transformer.TransformFinalBlock(base64Data, 0, base64Data.Length);

It's counterpart is ToBase64Transform.

Have fun.

rflagg
June 18th, 2002, 12:46 PM
Originally posted by AlenT
Try this code in C# to convert base64-encoded text (FromBase64Transform class can be found in System.Security.Cryptography namespace)

FromBase64Transform transformer = new FromBase64Transform();
byte[] byteData = transformer.TransformFinalBlock(base64Data, 0, base64Data.Length);

It's counterpart is ToBase64Transform.

Have fun.

Thanks. But that is just one piece of the MIME puzzle. I need something that can deMIME this shortened example:
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0000_01C20BF2.B40CBCC0"
Thread-Index: AcIMLVzIoG7skYNvTZqVxcybu46cew==
Content-Class: urn:content-classes:message
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C20BF2.B40CBCC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

This
is some text being sent along!
------=_NextPart_000_0000_01C20BF2.B40CBCC0
Content-Type: application/octet-stream;
name="rad2E822.tmp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="rad2E822.tmp"

gAAAANAMFgEAAAEMIwBClgAARQRcAAAAlloGAAABAAAAAAAABAAAAAAwMTkyMjQ4MCAgICAgICAg
IDA3NTI0MDAxIEEwMDEwMTAxQ0cgICAgNDcgICAgVUhSQlROOCAgICAgICAwMDI4ICAgICAgICAg
(This is the Base64 portion that your code snippit can decode!)
///////////////////////ABABA

------=_NextPart_000_0000_01C20BF2.B40CBCC0--

AlenT
June 18th, 2002, 05:47 PM
O-ops, sorry. Thought you only needed to decode the base64 attachement - that's the most difficult part usually - and the solution seemed simple enough using FromBase64Transform :).

Alen.