Gets the e-mail address of the sender.
[Visual Basic] Public Property From As MailAddress
[C#] public MailAddress From {get;}
[C++] public: __property MailAddress^ get_From();
[JScript] public function get From() :MailAddress;
Property Value
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.Load("c:\test.eml", False) 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.Load("c:\\test.eml", false); 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->Load("c:\\test.eml", false); 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.ReplyTo Property
Mail.To Property
Mail.Cc Property
Mail.TextBody Property
Mail.HtmlBody Property
Mail.Attachments Property
Online Tutorials
Parse Email in C# - Tutorial
Parse Email in VB.NET - Tutorial
Parse Email in C++/CLI - Tutorial