Loads a Outlook MSG (*.msg) file or binary email content to current Mail instance.
[Visual Basic] Public Sub LoadOMSG( _ fileName As String ) Public Sub LoadOMSG( _ content() As Byte _ )
[C#] public void LoadOMSG( string fileName ); public void LoadOMSG( byte[] content );
[C++] public: void LoadOMSG( String^ fileName ); public: void LoadOMSG( array<unsigned char> content );
[JScript] public function LoadOMSG( fileName : String ); public function LoadOMSG( content : Byte[] );
Parameters
Example
[Visual Basic, C#, C++] The following example demonstrates how to parse from, to, cc. To get the full samples of EAGetMail, please refer to Samples section.
[Visual Basic - Parse Email From, ReplyTo, To, CC] Imports EAGetMail Public Sub ParseMailAddress() Dim oMail As New Mail("TryIt") oMail.LoadOMSG("c:\test.msg") Dim addr As MailAddress = oMail.ReplyTo Console.WriteLine("Reply-To: {0} <{1}>", addr.Name, addr.Address) addr = oMail.From Console.WriteLine("From: {0} <{1}>", addr.Name, addr.Address) Dim addrs() As MailAddress = oMail.To Dim count As Integer = addrs.Length For i As Integer = 0 To count - 1 addr = addrs(i) Console.WriteLine("To: {0} <{1}>", addr.Name, addr.Address) Next addrs = oMail.Cc count = addrs.Length For i As Integer = 0 To count - 1 addr = addrs(i) Console.WriteLine("Cc: {0} <{1}>", addr.Name, addr.Address) Next End Sub
[C# - Parse Email From, ReplyTo, To, CC] using System; using System.Collections; using EAGetMail; public static void ParseMailAddress() { Mail oMail = new Mail("TryIt"); oMail.LoadOMSG("c:\\test.msg"); MailAddress addr = oMail.ReplyTo; Console.WriteLine("Reply-To: {0} <{1}>", addr.Name, addr.Address); addr = oMail.From; Console.WriteLine("From: {0} <{1}>", addr.Name, addr.Address); MailAddress[] addrs = oMail.To; int count = addrs.Length; for(int i = 0; i < count; i++) { addr = addrs[i]; Console.WriteLine("To: {0} <{1}>", addr.Name, addr.Address); } addrs = oMail.Cc; count = addrs.Length; for(int i = 0; i < count; i++) { addr = addrs[i]; Console.WriteLine("Cc: {0} <{1}>", addr.Name, addr.Address); } }
[C++/CLI - Parse Email From, ReplyTo, To, CC] using namespace System; using namespace System::Collections; using namespace EAGetMail; Void ParseMailAddress() { Mail ^oMail = gcnew Mail("TryIt"); oMail->LoadOMSG("c:\\test.msg"); MailAddress ^addr = oMail->ReplyTo; Console::WriteLine("Reply-To: {0} <{1}>", addr->Name, addr->Address); addr = oMail->From; Console::WriteLine("From: {0} <{1}>", addr->Name, addr->Address); array<MailAddress^> ^addrs = oMail->To; int count = addrs->Length; for(int i = 0; i < count; i++) { addr = addrs[i]; Console::WriteLine("To: {0} <{1}>", addr->Name, addr->Address); } addrs = oMail->Cc; count = addrs->Length; for(int i = 0; i < count; i++) { addr = addrs[i]; Console::WriteLine("Cc: {0} <{1}>", addr->Name, addr->Address); } }
See Also
Mail.Load Method
Mail.SaveAs Method
Mail.SaveAsOMSG Method
Online Tutorials
Parse Email in C# - Tutorial
Parse Email in VB.NET - Tutorial
Parse Email in C++/CLI - Tutorial