# Email Address

`Schema Alias: Umbraco.EmailAddress`

`UI Alias: Umb.PropertyEditorUi.EmailAddress`

`Returns: String`

Displays an email address.

## Settings

The Email Address Property Editor does not come with any further configuration. The property can be configured once it has been added to a Document Type.

![Checkbox Example](https://2050077833-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb0WSXUuM7Qx5BfREagAI%2Fuploads%2Fgit-blob-6806c536bb234da652a6b905905818a1c6f488b2%2Femailaddress-datatype.png?alt=media)

## Content Example

![Single email address content example](https://2050077833-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb0WSXUuM7Qx5BfREagAI%2Fuploads%2Fgit-blob-71b57446e232dd9f5be1e543718d47969bd825ad%2FEmailAddress-Content-v10.png?alt=media)

## MVC View Example

### Without Modelsbuilder

```csharp
@if (Model.HasValue("email"))
{
    var emailAddress = Model.Value<string>("email");
    <p>@emailAddress</p>
}
```

### With Modelsbuilder

```csharp
@if (!string.IsNullOrWhiteSpace(Model.Email))
{
    <p>@Model.Email</p>
}
```

## Add value programmatically

See the example below to learn how a value can be added or changed programmatically to an Email-address property. To update a value of a property editor you need the [Content Service](https://apidocs.umbraco.com/v17/csharp/api/Umbraco.Cms.Core.Services.ContentService.html).

{% hint style="info" %}
The example below demonstrates how to add values programmatically using a Razor view. However, this is used for illustrative purposes only and is not the recommended method for production environments.
{% endhint %}

```csharp
@using Umbraco.Cms.Core.Services;

@inject IContentService Services;
@{
    // Get access to ContentService
    var contentService = Services;

    // Create a variable for the GUID of your page
    var guid = new Guid("796a8d5c-b7bb-46d9-bc57-ab834d0d1248");

    // Get the page using the GUID you've just defined
    var content = contentService.GetById(guid);
    // Set the value of the property with alias 'email'
    content.SetValue("email", "jpk@umbraco.dk");

    // Save the change
    contentService.Save(content);
}
```

{% hint style="info" %}
The value sent to an EmailAddress property needs to be a correct email address, For example: <name@domain.com>.

It is recommended that you set up validation on this property, in order to verify whether the value added is in the correct format.
{% endhint %}
