PowerTCP Email Validation for .NET
from $149.00Available Platforms
Email Address Validation and List Verification Component
A .NET library that provides the flexibility, stability and ease-of-use desired for validation email addresses in your windows forms and ASP.NET projects. Includes C#, VB code examples and sample applications.
Validator1.Smtp.MailFrom = "validate@myDomain.com"; //must be set prior to validation
ValidationState result = Validator1.Validate("test@someDomain.com");
if (result.Exception == null)
MessageBox.Show("Confirmed at the " + result.Progress.ToString() + " level!", "Success!");
else
MessageBox.Show(result.Exception.InnerException.Message, result.Exception.Message);
Feature Overview
Flexibility
- Seven levels of validation featured
- Syntax verification is customizable
- Query mail servers for confirmation of recipients
- DNS and SMTP sessions are fully configurable
- Step-by-step, or completion-only, progress options
- MX Record and domain resolution capabilities
Performance
- Blacklist and Whitelist support
- Unique "Greenlist" feature for domains that always validate
- Domain caching options
- Persistent connections for shared domains
- Fully developed in managed C#
- 64-bit OS support
Ease-of-Use
- Complete list validation with a single method call
- SMTP and DNS protocol knowledge is not required
- Asynchronous (event-driven) and synchronous (blocking) support
- Full drag/drop integration within Visual Studio
- Integrates with Visual Studio 2005, 2008, 2010, 2012
- Many sample projects in C# and VB.NET, including ASP.NET
The PowerTCP Email Validation for .NET installation comes complete with the following:
- 10 Components/Major Classes.
- 6 Full Sample projects (in both VB.NET and C#).
- Full MS Help 2.0 Documentation, including extensive examples.
- Free Introductory Support.
Class | Description |
---|---|
EmailValidator Component | A component that validates an email address or list of email addresses. |
Dns Class | Provides domain name resolution. |
EnhancedStream Class | Adds new methods on top of the Stream interface for type conversion, stream copying, and saving. |
PipeStream Class | Represents a stream that wraps an internal stream. |
Proxy Class | Provides an easy way to manage communication with proxy servers |
Segment Class | Provides a reference to a data segment where data is sent or received over a TCP stream. |
SegmentedStream Class | Used to provide advanced reading/writing capabilities to Stream-based objects. |
SmtpTester Class | A class that encapsulates the SMTP connection in the validation process. |
TcpStream Class | TcpStream implements sending and receiving of data through network sockets. |
ValidationState Class | Represents the result of a validation operation. |
Supported Environments
All PowerTCP for .NET components and classes will operate on any Microsoft operating system that fully supports the Microsoft .NET Framework, including 64-bit Windows. .NET components are dependent on the Framework rather than a specific operating system. Products support .NET Framework versions 1.0, 1.1, 2.0, 3.0, 3.5, 4.0 and 4.5. The components can be used with any .NET compliant language, including the languages below:
- C#
- VB.NET
- Managed C++
- Standard Windows desktop applications
- Console applications
- ASP.NET web applications and Web Sites
- Windows service applications
- Web service applications
- Visual Studio .NET (2005, 2008, 2010, 2012)
PowerTCP for .NET components do not currently support execution within Silverlight. If you are interested in using Dart products within your Silverlight solution, contact support@dart.com for more options.
Code Examples
These PowerTCP Email Validation for .NET code snippets can be copied and pasted into your project.
Code Snippet | Description |
---|---|
Email Address Validation | Demonstrates how to validate an email address using concise blocking code |
Async Address Validation | Demonstrates how to validate an address using non-blocking (asynchronous) code. |
Address List Validation | Demonstrates how to validate a list of email addresses using blocking code. |
Async List Validation | Demonstrates how to validate a list of email addresses using non-blocking (asynchronous) code. |
Sample Projects Included
The samples are fully working applications in both C# and VB.NET and include complete source code.
Sample Name | Sample Description |
---|---|
Address Validator | Demonstrates how to configure the Validator component to validate a single email address. |
List Validator | Demonstrates how to configure the Validator component to validate a list of email addresses. |
Address Validator (Web) | Demonstrates how to use the Validator component to validate an email address on a web page. |
Product Release History
The following is a list of public releases for all components shipped with PowerTCP Email Validation for .NET (Latest Release 2008-06-16)
PowerTCP Email Validation for .NET
Current Version: 1.0.4.0
1.0.4.0 Released: 2008-06-16
- ASP.NET Sample update.
1.0.3.0 Released: 2008-05-14
Product fixes in this release:
- Fixed compile problem with ASP.NET samples.
1.0.1.0 Released: 2008-05-05
Product fixes in this release:
- Addressed problem with Validator component where initialization would fail if default DNS servers were not found on the system.
1.0.0.0 Released: 2007-03-23
- Dart Communications is pleased to announce a new addition to the PowerTCP product line. PowerTCP Email Validation for .NET adds tailored email address validation to both traditional desktop and ASP.NET web applications. This powerful product is ideal for any distributed application where validation of an email address or list of email addresses is desired. Mailing list maintenance, sales contact verification, and web form submission are a small sample of applications for this product.
The following example demonstrates validation of an email address using the PowerTCP Validator component. Progress is provided during the operation.
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(doValidation("yourAddress@gmail.com"));
}
private string doValidation(string emailAddress)
{
//Validate to the ultimate level.
validator1.ValidationLevel = ValidationLevel.SmtpRecipient;
//Raise the progress event for every validation step.
validator1.VerboseProgress = true;
//DNS settings.
validator1.Dns.Rotateservers = false; //always start with first server
validator1.Dns.Retries = 2; //try up to 3 times
validator1.Dns.Timeout = 5000; //5 seconds
//SMTP settings.
validator1.Smtp.MailFrom = "from@myDomain.com"; //required
validator1.Smtp.ConnectTimeout = 40000; //40 seconds
validator1.Smtp.ReceiveTimeout = 40000; //40 seconds
//Validate and return the result.
ValidationState result = validator1.Validate(emailAddress);
string description = "The validation of " + result.EmailAddress;
description += " proceeded to the "; + result.Progress.ToString() + " level. ";
description += (result.Exception == null)
? "The validation was successful."
: "The following exception occurred: " + result.Exception.ToString();
return description;
}
private void validator1_Progress(object sender, ProgressEventArgs e)
{
//Record validation progress to a log.
if (e.ValidationState.Exception == null)
textLog.AppendText(e.ValidationState.EmailAddress + " OK: " +
e.ValidationState.Progress.ToString() + Environment.NewLine);
else
textLog.AppendText(e.ValidationState.EmailAddress + " ERROR: " +
e.ValidationState.Exception.Message + Environment.NewLine);
}
The following example demonstrates non-blocking (asynchronous) validation of an email address using the PowerTCP Validator component. Progress is provided during the operation.
private void button1_Click(object sender, EventArgs e)
{
doValidation("yourAddress@gmail.com");
}
private void doValidation(string emailAddress)
{
//Validate to the ultimate level.
validator1.ValidationLevel = ValidationLevel.SmtpRecipient;
//Raise the progress event for every validation step.
validator1.VerboseProgress = true;
//DNS settings
validator1.Dns.RotateServers = false; //always start with first server
validator1.Dns.Retries = 2; //try up to 3 times
validator1.Dns.Timeout = 5000; //5 seconds
//SMTP settings
validator1.Smtp.MailFrom = "from@yourDomain.com"; //required
validator1.Smtp.ConnectTimeout = 40000; //40 seconds
validator1.Smtp.ReceiveTimeout = 40000; //40 seconds
//Validate. EndValidate event will fire with result.
validator1.BeginValidate(emailAddress, null);
}
private void validator1_EndValidate(object sender, ValidateEventArgs e)
{
//Examine the result.
//For single email validation, examine the first item in the Result array.
string result = "The validation of " + e.Result[0].EmailAddress;
result += " proceeded to the " + e.Result[0].Progress.ToString() + " level. ";
result += (e.Result[0].Exception == null)
? "The validation was successful."
: "The following exception occurred: " + e.Result[0].Exception.ToString();
//Pass the result to a displaying function.
display(result);
}
private void validator1_Progress(object sender, ProgressEventArgs e)
{
//Record validation progress to a log.
if (e.ValidationState.Exception == null)
textLog.AppendText(e.ValidationState.EmailAddress + " OK: " +
e.ValidationState.Progress.ToString() + Environment.NewLine);
else
textLog.AppendText(e.ValidationState.EmailAddress + " ERROR: " +
e.ValidationState.Exception.Message + Environment.NewLine);
}
private void display(string message)
{
//Show result of validation operation.
MessageBox.Show(message);
}
The following example demonstrates validation of a list of email addresses using the PowerTCP Validator component. Progress is provided during the operation.
private string[] doValidation()
{
//Validation settings.
validator1.ValidationLevel = ValidationLevel.SmtpRecipient; //final level
validator1.BlackList = getList(Application.StartupPath + "\\blacklist.txt");
validator1.WhiteList = getList(Application.StartupPath + "\\whitelist.txt");
validator1.DomainCacheTimeout = 300; //300 second (5 minute) domain cache
validator1.Smtp.TestAccount = "qwerty1298mnbvc"; //skip known "false positives"
//DNS settings.
validator1.Dns.RotateServers = false; //always start with first server
validator1.Dns.Retries = 2; //try up to 3 times
validator1.Dns.Timeout = 5000; //5 seconds
//SMTP settings.
validator1.Smtp.MailFrom = "myAccount@myDomain.com"; //required
validator1.Smtp.ConnectTimeout = 40000; //40 seconds
validator1.Smtp.ReceiveTimeout = 40000; //40 seconds
//Validate list.
ValidationState[] results =
validator1.Validate(getList(Application.StartupPath + "\\myList.txt"));
//Return results in an array.
string[] descriptions = new string[results.Length];
for (int i=0; i<results.Length; i++)
{
descriptions[i] = "The validation of " + results[i].EmailAddress;
descriptions[i] += " proceeded to the " + results[i].Progress.ToString();
descriptions[i] += " level. ";
descriptions[i] += (results[i].Exception == null)
? "The validation was successful."
: "The following exception occurred: " + results[i].Exception.ToString();
}
return descriptions;
}
private StringCollection getList(string filename)
{
//Read a list from a file.
StringCollection list = new StringCollection();
StreamReader reader = new StreamReader(filename);
while (reader.Peek() >= 0)
list.Add(reader.ReadLine());
reader.Close();
return list;
}
private void validator1_Progress(object sender, ProgressEventArgs e)
{
//Record validation progress to a log.
if (e.ValidationState.Exception == null)
textLog.AppendText(e.ValidationState.EmailAddress + " OK: " +
e.ValidationState.Progress.ToString() + Environment.NewLine);
else
textLog.AppendText(e.ValidationState.EmailAddress + " ERROR: " +
e.ValidationState.Exception.Message + Environment.NewLine);
}
The following example demonstrates non-blocking (asynchronous) validation of a list of email addresses using the PowerTCP Validator component. Progress is provided during the operation.
private void doValidation()
{
//Validation settings.
validator1.ValidationLevel = ValidationLevel.SmtpRecipient; //final level
validator1.BlackList = getList(Application.StartupPath + "\\blacklist.txt");
validator1.WhiteList = getList(Application.StartupPath + "\\whitelist.txt");
validator1.DomainCacheTimeout = 300; //300 second (5 minute) domain cache
validator1.Smtp.TestAccount = "qwerty1298mnbvc"; //skip known "false positives"
//DNS settings.
validator1.Dns.RotateServers = false; //always start with first server
validator1.Dns.Retries = 2; //try up to 3 times
validator1.Dns.Timeout = 5000; //5 seconds
//SMTP settings.
validator1.Smtp.MailFrom = "myAccount@myDomain.com"; //required
validator1.Smtp.ConnectTimeout = 40000; //40 seconds
validator1.Smtp.ReceiveTimeout = 40000; //40 seconds
//Validate. EndValidate event raises with result.
validator1.BeginValidate(getList(Application.StartupPath + "\\myList.txt"), null);
}
private void validator1_EndValidate(object sender, ValidateEventArgs e)
{
//Examine the results.
string[] results = new string[e.Result.Length];
for (int i=0; i<results.Length; i++)
{
results[i] = "The validation of " + e.Result[i].EmailAddress;
results[i] += " proceeded to the " + e.Result[i].Progress.ToString();
results[i] += " level. ";
results[i] += (e.Result[i].Exception == null)
? "The validation was successful."
: "The following exception occurred: " + e.Result[i].Exception.Message;
}
//Pass the results to a displaying function.
display(results);
}
private void validator1_Progress(object sender, ProgressEventArgs e)
{
//Record validation progress to a log.
if (e.ValidationState.Exception == null)
textLog.AppendText(e.ValidationState.EmailAddress + " OK: " +
e.ValidationState.Progress.ToString() + Environment.NewLine);
else
textLog.AppendText(e.ValidationState.EmailAddress + " ERROR: " +
e.ValidationState.Exception.Message + Environment.NewLine);
}
private StringCollection getList(string filename)
{
//Read a list from a file.
StringCollection list = new StringCollection();
StreamReader reader = new StreamReader(filename);
while (reader.Peek() >= 0)
list.Add(reader.ReadLine());
reader.Close();
return list;
}
private void display(string[] results)
{
//Display the validation results.
foreach (string result in results)
textResults.AppendText(result + Environment.NewLine);
}
Validator .NET Component
Use the Validator component to integrate email address confirmation into any .NET application. Included features:
- Easily validates large lists of email addresses.
- Verify addresses to seven levels of validation, from syntax check to querying accounts on mail servers:
- Syntax. The address is formatted correctly.
- Blacklist. Check for known bad email addresses.
- Whitelist. Check for known good email addresses.
- Greenlist. Check for addresses with domains that confirm all addresses.
- DnsLookup. Check for mail exchange servers (MX records) associated with the email address.
- SmtpConnect. Attempt to connect to these mail servers.
- SmtpRecipient. Query these servers for the existence of the email address's mailbox.
- Includes a domain cache option for eliminating redundant DNS queries.
- Utilizes a "greenlist" for servers that return false positive responses.
- Persists connections for email addresses hosted on the same domain for increased performance.
- Includes fully configurable classes for regulating DNS and SMTP connections.
- Supports both synchronous and asynchronous application designs.
- Trace events expose the underlying DNS and SMTP connections.
- C# and VB.NET sample projects included.
- Includes a royalty-free license!
Interface
Public Constructors |
|
Validator | Overloaded. Initialize a new instance of the Validator class. |
Public Properties | |
Blacklist | Gets or sets a list of bad addresses and/or domains. |
Dns | Gets a Dns object used for DNS functionality. |
DoEvents | Gets or sets a value that controls the processing of events during blocking method calls. |
DomainCacheTimeout | Gets or sets the internal domain cache's timeout value (in seconds). |
Greenlist | Gets a list of servers that always provide a positive response to a recipient query. |
Pattern | Gets or sets the Regular Expression pattern used when an email address's syntax is validated. |
Smtp | Gets an SmtpTester object for SMTP functionality. |
SynchronizingObject | Set this object to automatically control thread marshaling between worker threads and the main UI thread. |
ValidationLevel | Gets or sets a value indicating the level to which validations should be performed. |
VerboseProgress | Gets or sets a value indicating whether the Progress event should fire when the validation progresses to each ValidationLevel. |
Whitelist | Gets or sets a list of good addresses and/or domains. |
Public Methods | |
Abort | Aborts the Validation process. |
BeginValidate | Validates email addresses in a non-blocking fashion. |
Validate | Validates email addresses in a blocking fashion. |
Public Events | |
EndValidate | Raised when a BeginValidate call is completed. |
Progress | Raised when a Validate or BeginValidate call is completed, and during the validation process when VerboseProgress is true. |
Code Example
How easy is the Validator component to use? The following VB.NET snippet demonstrates blocking validation of an email address.
VB.NET Example
Private Function doValidation(ByVal emailAddress As String) As String
'Add "Imports Dart.PowerTCP.EmailValidation" at the top
'Validate to the final level
Validator1.ValidationLevel = ValidationLevel.SmtpRecipient
Validator1.Smtp.MailFrom = "myAccount@myDomain.com" 'required
'Validate and return the result
Dim result As ValidationState = Validator1.Validate(emailAddress)
Dim description As String = "The validation of " + result.EmailAddress + " proceeded to the "
description += result.Progress.ToString() + " level. "
If (result.Exception Is Nothing) Then
description += "The validation was successful."
Else
description += "The following exception occurred: " + result.Exception.ToString()
End If
Return description
End Function
Purchase Options
Customize your product and support options match your needs. Discounts are applied when products are purchased in multiples or within available product suites.
Have any questions about purchasing? See our Sales FAQ