MailAddress.Name Property


Gets the display name.

[Visual Basic]
Public Property Name As String
[C#]
public string Name {get;}
[C++]
public: __property String^ get_Name();
[JScript]
public function get Name() : String;

Property Value

A String value indicating the friendly 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