title: "The SMTP host was not specified." - but it is specified?
body: <p>I'm slightly baffled here - I'm receiving the following error: </p>
  
  <blockquote>
    <p>The SMTP host was not specified.</p>
  </blockquote>
  
  <p>Even though my code appears to be correct (from what I can see). </p>
  
  <p>I am able to do it manually by including all the details inside of the controller, e.g.</p>
  
  <pre><code>SmtpClient smtpClient = new SmtpClient("smtp.gmail.com");
  smtpClient.Port = 587;
  ... etc
  </code></pre>
  
  <p>But I shouldn't have to do this, as I want to use the details inside <code>mailSettings</code> (Making it re-usable for various different controllers).</p>
  
  <p><code>mailSettings</code> in my <code>Web.Config</code> file:</p>
  
  <pre><code>&lt;system.net&gt;
     &lt;mailSettings&gt;
       &lt;smtp from="example@gmail.com" deliveryMethod="Network" &gt;
         &lt;network host="smtp.gmail.com" defaultCredentials="true" 
                  port="587" enableSsl="true" userName="example@gmail.com"
                  password="example"/&gt;
       &lt;/smtp&gt;
     &lt;/mailSettings&gt;
  &lt;/system.net&gt;
  </code></pre>
  
  <p>My Controller action:</p>
  
  <pre><code> [HttpPost]
   public ActionResult SubmitFeature(FormData formData)
   {
       SmtpClient smtpClient = new SmtpClient();
  
       MailMessage mail = new MailMessage();
       mail.To.Add(new MailAddress("example@gmail.com"));
       mail.Body = "Test";
  
       smtpClient.Send(mail);
  
       return View("Example");
   }
  </code></pre>
  
  <p>Is there anything I'm missing which may be causing this? I haven't messed around with any other settings in Web.Config, they are as is when setting up a new MVC5 project.</p>