title: Sending e-mail in ASP .Net
body: <p>How to send e-mail on ASP .Net using outlook address??</p>
  
  <p>I've tried this code but no luck:</p>
  
  <pre><code>Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
  
  mailMessage.From = New System.Net.Mail.MailAddress("fromAddress")
  mailMessage.To.Add(New System.Net.Mail.MailAddress("toAddress"))
  
  mailMessage.Priority = Net.Mail.MailPriority.High
  mailMessage.Subject = "Subject"
  mailMessage.Body = "test"
  
  Dim smtpClient As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient("xxx.outlook.com", portNumber)
  
  smtpClient.Send(mailMessage) //--&gt; got error here
  </code></pre>
  
  <p>But while I'm execute the code, it got this error message: </p>
  
  <pre><code>The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated
  </code></pre>
  
  <p>I've tried to add a line of code:</p>
  
  <p><strong>smtpClient.Credentials = New System.Net.NetworkCredential(username, password)</strong></p>
  
  <p>But still can't send the e-mail.</p>
  
  <p>Anyone can help?</p>