| Visual Basic (Declaration) | |
|---|---|
Public Function New( _ ByVal eMailAddress As String _ ) | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim eMailAddress As String Dim instance As New MailAddress(eMailAddress) | |
| C# | |
|---|---|
public MailAddress( string eMailAddress ) | |
| Managed Extensions for C++ | |
|---|---|
public: MailAddress( string* eMailAddress ) | |
| C++/CLI | |
|---|---|
public: MailAddress( String^ eMailAddress ) | |
Parameters
- eMailAddress
- The email address this object is to represent
The following example demonstrates the properties of a MailAddress object.
| Visual Basic | Copy 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> | |
When using PowerTCP, email addresses are represented by MailAddress objects. A MailAddress object can be created using this constructor like so:
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.
Target Platforms: Microsoft .NET Framework 2.0