PowerTCP Mail for .NET
MailAddress Class
Members  Example  See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace : MailAddress Class




The MailAddress object represents a single email address.

Object Model

MailAddress ClassResponse Class

Syntax

Visual Basic (Declaration) 
Public Class MailAddress 
Visual Basic (Usage)Copy Code
Dim instance As MailAddress
C# 
public class MailAddress 
Managed Extensions for C++ 
public __gc class MailAddress 
C++/CLI 
public ref class MailAddress 

Example

The following example demonstrates the properties of a MailAddress object.
Visual BasicCopy Code
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Mail"
' at the top of your class.

' Create a new MailAddress, supplying the address and friendly name.
Dim ma As New MailAddress("""Fake Name"" test@dart.com")
Debug.WriteLine("Network formatted address: " + ma.Address)
Debug.WriteLine("Domain of the address: " + ma.Domain)
Debug.WriteLine("Friendly name: " + ma.Friendly)
Debug.WriteLine("User name: " + ma.User)
Debug.WriteLine("All address data: " + ma.ToString());

' Output
' --------------------------------
' Network formatted address: <test@dart.com>
' Domain of the address: dart.com
' Friendly name: Fake Name
' User name: test
' All address data: "Fake Name" <test@dart.com>
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// Create a new MailAddress, supplying the address and friendly name.
MailAddress ma = new MailAddress("\"Fake Name\" test@dart.com");
Debug.WriteLine("Network formatted address: " + ma.Address);
Debug.WriteLine("Domain of the address: " + ma.Domain);
Debug.WriteLine("Friendly name: " + ma.Friendly);
Debug.WriteLine("User name: " + ma.User);
Debug.WriteLine("All address data: " + ma.ToString())

// Output
// --------------------------------
// Network formatted address: <test@dart.com>
// Domain of the address: dart.com
// Friendly name: Fake Name
// User name: test
// All address data: "Fake Name" <test@dart.com>

Remarks

When using PowerTCP, email addresses are represented by MailAddress objects. MailAddress objects are created by passing an email address into the MailAddress constructor. This can be done one of two ways:

  1. Pass in the email address only.

    MailAddress m = new MailAddress("me@myserver.com");
    					

    This will create a MailAddress object and populate the MailAddress.Address, MailAddress.Domain, and MailAddress.User properties. The MailAddress.Friendly property will be an empty string, and will have to be explicitly set.

  2. Pass in the email and friendly address.

    MailAddress m = new MailAddress("\"Bob Test\" me@myserver.com");
    					

    This will create a MailAddress object and populate the MailAddress.Address, MailAddress.Domain, MailAddress.Friendly, and MailAddress.User properties.

Inheritance Hierarchy

System.Object
   Dart.PowerTCP.Mail.MailAddress

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.