title: SMTP not sending email in production (IIS)
body: <p>I have a function which on confirmed order sends an email to the client with order details, the function is an async Task which simply use <code>SmtpClient</code>.</p>
  <p>The issue is that while i'm in debug in VS 2019, the mail is sent, but when i try to host the service to my local IIS no mails are sent..</p>
  <p>My function looks like this:</p>
  <pre><code>   public static async Task&lt;bool&gt; SendRiepilogoAsync(string piva, int idOrdine)
          {
              var order = GetOrdine(piva, idOrdine);
              if (order == null)
              {
                  return false;
              }
              try
              {
  ...
  
                  using var smtp = new SmtpClient(&quot;smtps.aruba.it&quot;, 587)
                  {
                      DeliveryMethod = SmtpDeliveryMethod.Network,
                      UseDefaultCredentials = false,
                      EnableSsl = true,
                      Credentials = new NetworkCredential(&quot;xxx&quot;, &quot;xxx&quot;)
                  };
                  await smtp.SendMailAsync(message);
              }
              catch (Exception e)
              {
                  return false;
              }
  
              ConfirmEmail(piva, idOrdine);
              return true;
          }
  </code></pre>
  <p>And it's called from a sync function (confirmOrder) like this:</p>
  <pre><code> var emailTask = EmailHelper.SendRiepilogoAsync(piva, int.Parse(orderID));
  </code></pre>