Home | Demo | Contact Us | Download | Support | Purchase | Products


Other Products
 
  "The Advanced Intellect components I've used (aspNetEmail, aspNetPOP3, aspNetMX) have all been well-designed and reliable. These products have added key functionality to my applications, but my greatest recommendation relates to Dave's friendly and bend-over-backwards support. When I had questions, he was easy to reach, courteous and helpful. Thanks so much!"
Michael Kane
CTO, Commontales
 
More
Testimonials

Read an email from the Filesystem

The following example demonstrates opening an email from the filesystem, and passing the stream into the construct of aspNetMime


[C#]

//an email on the filesystem
string filename = "testEmail.eml";

//open the email
FileStream fs = File.Open( filename, FileMode.Open );

//this creates a Message from a stream
aspNetMime.MimeMessage msg = new aspNetMime.MimeMessage( fs );

//close the stream
fs.Close();

foreach( Header h in msg.Headers )
{
	Console.WriteLine( "Name -- " +  h.Name );
	Console.WriteLine( "Value -- " + h.Value );
	Console.WriteLine( "Complete Value (includes parameters) -- " + h.ValueComplete );
	Console.WriteLine( "The raw header -- " + h.RawValue );
}


Console.WriteLine( "done..." );
Console.ReadLine();

 

[VB.NET]

'an email on the filesystem
Dim filename As String =  "testEmail.eml" 
 
'open the email
Dim fs As FileStream =  File.Open(filename,FileMode.Open) 
 
'this creates a Message from a stream
Dim msg As aspNetMime.MimeMessage =  New aspNetMime.MimeMessage(fs) 
 
'close the stream
fs.Close()
 
Dim h As Header
For Each h In msg.Headers
	Console.WriteLine("Name -- " +  h.Name)
	Console.WriteLine("Value -- " + h.Value)
	Console.WriteLine("Complete Value (includes parameters) -- " + h.ValueComplete)
	Console.WriteLine("The raw header -- " + h.RawValue)
Next
 
 
Console.WriteLine("done...")
Console.ReadLine()

 



The box is not shipped. aspNetMime is a downloadable product.