title: smtp client and accessing username and password from configuration code
body: <p>If I have mail settings inside web.config </p>
  
  <pre><code>  &lt;system.net&gt;
    &lt;mailSettings&gt;
      &lt;smtp deliveryMethod="Network" from="&amp;quot;testo&amp;quot; &amp;lt;admin@test.com&amp;gt;" &gt;
        &lt;network host="mail.test.com" userName="admin@test.com" password="waiff75E-" port="25"/&gt;
      &lt;/smtp&gt;
    &lt;/mailSettings&gt;
  &lt;/system.net&gt;
  </code></pre>
  
  <p>and if I'm using following code to send mail from c# code</p>
  
  <pre><code>smtpclient.EnableSsl = false;
  smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network;
  smtpclient.Credentials = new System.Net.NetworkCredential(username, password);
  smtpclient.Send(mail);
  </code></pre>
  
  <p>how can I configure here to username and password from above configuarion code?</p>