title: Email address validation using ASP.NET MVC data type attributes
body: <p>I have some problems with the validation of a Email.</p>
  
  <p>In my Model:</p>
  
  <pre><code>[Required(ErrorMessage = "Field can't be empty")]
  [DataType(DataType.EmailAddress, ErrorMessage = "E-mail is not valid")]
  public string ReceiverMail { get; set; }
  </code></pre>
  
  <p>In my view:</p>
  
  <pre><code>&lt;script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  
  @Html.TextBoxFor(m =&gt; m.ReceiverMail, new { @placeholder="E-mail"}) &lt;br /&gt;
  @Html.ValidationMessageFor(m =&gt; m.ReceiverMail)
  </code></pre>
  
  <p>Now it is correctly showing me "Field can't be empty" when you leave the field empty.
  But when you fill in an invalid email address like: "fwenrjfw" then the form does not say "E-mail is not valid".</p>
  
  <p>How can I get the form to validate the input as an email address? I am looking for some help with this. </p>