Provides properties and methods for presenting an e-mail address including display name, e-mail address.
System.Object
EAGetMail.MailAddress
[Visual Basic] Public Class MailAddress
[C#] public class MailAddress
[C++] public ref class MailAddress
[JScript] public class MailAddress
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Public Constructors
MailAddress Constructor | Initializes a new instance of the MailAddress class. |
Public Properties
Address | Gets the e-mail address. |
Name | Gets the display name. |
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.From Property
Mail.Cc Property
Online Tutorials
Parse Email in C# - Tutorial
Parse Email in VB.NET - Tutorial
Parse Email in C++/CLI - Tutorial