VB.NET || How To Validate An Email Address Using VB.NET

Print Friendly, PDF & Email

The following is a module with functions which demonstrates how to determine if an email address is valid using VB.NET.

This function is based on RFC2821 and RFC2822 to determine the validity of an email address.


1. Validate Email – Basic Usage

The example below demonstrates the use of ‘Utils.Email.IsValid‘ to determine if an email address is valid.


2. Validate Email – Additional Options

The example below demonstrates the use of ‘Utils.Email.IsValid‘ to determine if an email address is valid with additional validation options.

Supplying options to verify an email address uses the default validity rules, in addition to the provided validation options.

This allows you to add custom rules to determine if an email is valid or not. For example, the misspelling of common email domains, or known spam domains.


3. Utils Namespace

The following is the Utils Namespace. Include this in your project to start using!


4. More Examples

Below are more examples demonstrating the use of the ‘Utils‘ Namespace. Don’t forget to include the module when running the examples!

QUICK NOTES:
The highlighted lines are sections of interest to look out for.

The code is heavily commented, so no further insight is necessary. If you have any questions, feel free to leave a comment below.

Leave a Reply