# EmailValidationRule

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (3.2.0.0)

* [ValidationRule](https://docs.wisej.com/api/v3.2/wisej.web/extenders/validation/wisej.web.validationrule)
  * [EmailValidationRule](https://docs.wisej.com/api/v3.2/wisej.web/extenders/validation/wisej.web.emailvalidationrule)

Validates email addresses.

{% tabs %}
{% tab title="C#" %}

```csharp
public class EmailValidationRule : ValidationRule
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class EmailValidationRule
    Inherits ValidationRule
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](https://3811934619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaN9qL9rX9v301dsI6CfD%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=bc63f9cf-3241-48ac-8cb4-46d1df1d13df)EmailValidationRule()

Initializes a new instance of [EmailValidationRule](https://docs.wisej.com/api/v3.2/wisej.web/extenders/validation/wisej.web.emailvalidationrule).

## Properties

### ![](https://3811934619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaN9qL9rX9v301dsI6CfD%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=bc63f9cf-3241-48ac-8cb4-46d1df1d13df)InvalidDomains

[String\[\]](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets a list of invalid domains: i.e. "dropmail.com", "protonmail.com". (Default: `null`)

### ![](https://3811934619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaN9qL9rX9v301dsI6CfD%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=bc63f9cf-3241-48ac-8cb4-46d1df1d13df)Name

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name of the validation rule. (Default: `"Email"`)

### ![](https://3811934619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaN9qL9rX9v301dsI6CfD%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=bc63f9cf-3241-48ac-8cb4-46d1df1d13df)Required

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the control can be empty or its required to have a value. (Default: `False`)

### ![](https://3811934619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaN9qL9rX9v301dsI6CfD%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=bc63f9cf-3241-48ac-8cb4-46d1df1d13df)ValidDomains

[String\[\]](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets a list of valid domains: i.e. "mycompany.com", "gmail.com", "hotmail.com". (Default: `null`)

## Methods

### ![](https://3811934619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaN9qL9rX9v301dsI6CfD%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media\&token=bc63f9cf-3241-48ac-8cb4-46d1df1d13df)OnValidating(control)

Validates the *control* using the validation rule.

| Parameter   | Type                                                                 | Description |
| ----------- | -------------------------------------------------------------------- | ----------- |
| **control** | [Control](https://docs.wisej.com/api/v3.2/wisej.web/general/control) |             |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the validation is successful; otherwise false.
