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";
//this creates a MimeMessage from a stream
aspNetMime.MimeMessage msg = MimeMessage.ParseFile( filename );
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"
'this creates a MimeMessage from a file
Dim msg As aspNetMime.MimeMessage = MimeMessage.ParseFile( filename )
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()