In this article you can learn how to use the build in email property editor
Alias: Umbraco.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.
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.
@using Umbraco.Cms.Core.Services;@inject IContentService Services;@{ // Get access to ContentServicevar contentService = Services; // Create a variable for the GUID of your pagevar guid =newGuid("796a8d5c-b7bb-46d9-bc57-ab834d0d1248"); // Get the page using the GUID you've just definedvar content =contentService.GetById(guid); // Set the value of the property with alias 'email'content.SetValue("email","jpk@umbraco.dk"); // Save the changecontentService.Save(content);}
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.