title: Cannot send email using SmtpClient in ASP.NET
body: <p>I want to send email in ASP.NET MVC website but it doesn't work.</p>
  <p>I think the problem is with this exception here</p>
  <p>'client.ServicePoint.Address' threw an exception of type 'System.NotSupportedException' with type System.Uri {System.NotSupportedException}.</p>
  <p>after the code</p>
  <pre><code>var client = new SmtpClient(&quot;smtp.office365.com&quot;, 25)
  </code></pre>
  <p>In this document <a href="https://docs.microsoft.com/en-us/dotnet/api/system.net.servicepoint.address?view=netcore-3.1" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/dotnet/api/system.net.servicepoint.address?view=netcore-3.1</a>, it says the exception is due to &quot;The ServicePoint is in host mode.&quot; which I have no idea.</p>
  <p>Could anyone explain it and tell me how to resolve?</p>
  <p>Thanks,</p>