VS.NET 2010 (and above) Users Click Here   

HOMECONTACT PRODUCTS DOWNLOADS PURCHASE TESTIMONIALS FORUMS COMPANY CONTACT
Home
Products
Downloads
Purchase
Licensing
Licensing FAQ
Software Updates
Support Forums
Testimonials
Feature Requests
Guarantee
About Us
Contact Us
Hosting Companies
Privacy Policy
   
Shopping Cart


aspNetMime forum



[ Reply to Post ] [ Back To Forum ]
From: "dave wanta" <dave@...>
Date: 4/6/2012 1:16:40 PM
Subject: RE: TNEF message with odd characters
Thanks for the sample file.

Here is a code example, that gets you to the underlying byte array, and allows you to use any Encoding sheme you want to decode the byte array.

static void BlakeSmith2()
{
	string path = @"C:\temp\FunnyCharacters\FunnyCharacters.eml";

	MimeMessage m= MimeMessage.ParseFile( path );
	TnefMessage tnef = m.TnefMessage();

	byte[] data = FindHtmlBinary(tnef);

	if( data != null )
	{
		string s = Encoding.UTF8.GetString( data );

		StreamWriter sw= new StreamWriter( "c:\\temp\\blake2.html");
		sw.Write( s );
		sw.Flush();
		sw.Close();
	}

}
static byte[] FindHtmlBinary(TnefMessage tnef)
{
	byte[] data = null;
	ArrayList properties = tnef.FindMapiProperties( MapiAttribute.PR_HTML, true );
	if( (properties != null ) && ( properties.Count > 0 ) )
	{
		for( int i=0;i<properties.Count;i++)
		{
			MapiProperty prop = properties[ i ] as MapiProperty;
			if( (prop != null) && ( prop.Value != null )  )
			{
				data = (byte[])prop.Value;
				return data;
			}
		}
	}
	return data;
}




Let me know if you need anything else,
Dave

 

 

 



Thread View

Subject By Date
TNEF message with odd characters Blake 4/5/2012
   RE: TNEF message with odd characters dave wanta 4/5/2012
   RE: TNEF message with odd characters [ you are here ] dave wanta 4/6/2012

 

 

Testimonial

I really enjoy using your product and recommend it to anyone asking about an email solution! "

D. Humphrey | loanproposals.com

Read more testimonials
ListNanny aspNetDNS aspNetEmail aspNetPOP3 aspNetMX IPMuncher aspNetMIME aspNetPING aspNetTraceRoute aspNetIMAP aspNetMHT