PowerTCP Mail for .NET
Verify Method
See Also  Example Send comments on this topic.
Dart.PowerTCP.Mail Namespace > MailAddresses Class : Verify Method




servers
Comma-delimited list of DNS servers to use for verification.
timeout
Specifies the amount of time to wait for a response to a query to a DNS server.
Attempts to verify the validity of addresses contained within the MailAddresses collection by doing a DNS lookup.

Syntax

Visual Basic (Declaration) 
Public Sub Verify( _
   ByVal servers As String, _
   ByVal timeout As Integer _
) 
Visual Basic (Usage)Copy Code
Dim instance As MailAddresses
Dim servers As String
Dim timeout As Integer
 
instance.Verify(servers, timeout)
C# 
public void Verify( 
   string servers,
   int timeout
)
Managed Extensions for C++ 
public: void Verify( 
   string* servers,
   int timeout
) 
C++/CLI 
public:
void Verify( 
   String^ servers,
   int timeout
) 

Parameters

servers
Comma-delimited list of DNS servers to use for verification.
timeout
Specifies the amount of time to wait for a response to a query to a DNS server.

Example

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

' Create a MailAddresses collection populated with some addresses
Dim ma As New MailAddresses("sales@dart.com,bad@fake.com,support@dart.com")

' Verify the addresses against the specified DNS servers
ma.Verify("206.64.128.5,198.6.1.2,198.6.1.3", 20000)

' Check the response to each address.
Dim m As MailAddress
For Each m In ma
   If m.ServerResponse.Code = 250 Then
      System.Diagnostics.Debug.WriteLine(m.Address + " is OK")
   Else
      System.Diagnostics.Debug.WriteLine(m.Address + " is bad")
   End If
Next
C#Copy Code
// Be sure to import the namespace by putting "using Dart.PowerTCP.Mail;"
// at the top of your class.

// Create a MailAddresses collection populated with some addresses
MailAddresses ma = new MailAddresses("sales@dart.com,bad@fake.com,support@dart.com");

// Verify the addresses against the specified DNS servers
ma.Verify("206.64.128.5,198.6.1.2,198.6.1.3", 20000);

// Check the response to each address.
foreach(MailAddress m in ma)
   if(m.ServerResponse.Code == 250)
      System.Diagnostics.Debug.WriteLine(m.Address + " is OK");
   else
      System.Diagnostics.Debug.WriteLine(m.Address + " is bad");

Remarks

This method attempts to verify the validity of all MailAddress objects in the MailAddresses collection. When this method is called, the MailAddress.ServerResponse property is set from the response from the server. The MailAddress.ServerResponse property is a Response object which encapsulates the response from the server. To see if verification succeeded or failed, check the Response.Code and Response.Text properties. If verification succeeded, the response will be formatted as "hostnameCRLFdot.add.res.s". If verification did not succeed, the ServerResponse property will return null, so be sure to always check for null before accessing the properties of ServerResponse.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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