title: Cannot get IIS pickup directory (From Windows Service)
body: <p>I am facing the above-mentioned error while sending emails from windows service. Your suggestion is much appreciated.</p>
  
  <pre><code>SmtpClient smtpClient = new SmtpClient();
  MailMessage mailMsg = this.ComposeMailMessage();
  smtpClient.Send(mailMsg);
  </code></pre>
  
  <p><em>Configuration</em></p>
  
  <pre><code>&lt;system.net&gt;
      &lt;mailSettings&gt;
          &lt;smtp from="user1@mycompany.com" deliveryMethod="Network"&gt;
              &lt;network host="smtpsvr.mycompany.com" port="25" defaultCredentials="true" /&gt;
          &lt;/smtp&gt;
      &lt;/mailSettings&gt;
  &lt;/system.net&gt;
  </code></pre>