title: How to send mail (System.Net.Mail)?
body: <p>I tried to send email via c# by following:</p>
  
  <pre><code>  try {
                  MailMessage message = new MailMessage();
                  message.To.Add("receiver@mail.com");
                  message.Subject = "This is the Subject line";
                  message.From = new MailAddress("sender@online.microsoft.com");
                  message.Body = "This is the message body";
                  SmtpClient smtp = new SmtpClient("http://schemas.microsoft.com/cdo/configuration/smtpserver");
                  smtp.Send(message);
              } catch (Exception ex) {
                  Response.Write(ex.ToString());
              }
  </code></pre>
  
  <p>I get the error message:</p>
  
  <blockquote>
    <p>System.Net.Mail.SmtpException: Failure sending mail. --->
    System.Net.WebException: The remote name could not be resolved:
    '<a href="http://schemas.microsoft.com/cdo/configuration/smtpserver" rel="nofollow noreferrer">http://schemas.microsoft.com/cdo/configuration/smtpserver</a>' at
    System.Net.ServicePoint.GetConnection(PooledStream PooledStream,
    Object owner, Boolean async, IPAddress&amp; address, Socket&amp; abortSocket,
    Socket&amp; abortSocket6) at......</p>
  </blockquote>
  
  <p>I've never done this before. Any help would be much appreciated.</p>