title: challenging with mailing in asp.net form
body: <p>i have made the this form and this C# code for mailing (Contact us form)
  ihave this error </p>
  
  <p>The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. m2sm37748843wjf.42 - gsmtp</p>
  
  <p>and this is my code </p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      lblError.Visible = false;
  }
  
  protected void Button1_Click(object sender, EventArgs e)
  {
      if (Page.IsValid)
      {
          try
          {
              string strbody = string.Empty;
              strbody += string.Format("&lt;b&gt;Name &lt;/b&gt; :{0} &lt;br /&gt; ", TextboxName.Text);
              strbody += string.Format("&lt;b&gt;E-Mail&lt;/b&gt;: &lt;a href='mailto:{0}'&gt;{0}&lt;/a&gt;&lt;br /&gt;", textboxemail.Text);
              strbody += string.Format("&lt;b&gt; Subject&lt;/b&gt; :{0} &lt;br /&gt;", textboxwebsite.Text);
              strbody += string.Format("&lt;b&gt;Description&lt;/b&gt;: {0}&lt;br /&gt;",                           textboxmessage.Text.Replace("\n", "&lt;br /&gt;"));
  
              System.Net.Mail.MailMessage oMailMessage = new                           System.Net.Mail.MailMessage();
              System.Net.Mail.MailAddress oMailAddress = null;
              oMailAddress = new System.Net.Mail.MailAddress
                  (
                      "salarzardouz@gmail.com",
                      "Sent By salar zardouz website",
                      System.Text.Encoding.UTF8
                  );
              oMailMessage.From = oMailAddress;
              oMailMessage.Sender = oMailAddress;
              oMailMessage.To.Clear();
              oMailMessage.CC.Clear();
              oMailMessage.Bcc.Clear();
              oMailMessage.ReplyToList.Clear();
              oMailMessage.Attachments.Clear();
              oMailMessage.ReplyToList.Add(oMailAddress);
              oMailMessage.Bcc.Add("salarzardouz@outlook.com");
              oMailAddress = new System.Net.Mail.MailAddress
                  (
                      textboxemail.Text,
                      textboxmessage.Text,
                      System.Text.Encoding.UTF8
                  );
              oMailMessage.To.Add(oMailAddress);
  
              oMailMessage.BodyEncoding = System.Text.Encoding.UTF8;
              oMailMessage.Body = strbody;
  
              oMailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
              oMailMessage.Subject = "[-&lt;Company Name&gt;-] - " + textboxwebsite.Text;
  
              oMailMessage.IsBodyHtml = true;
  
              oMailMessage.Priority = System.Net.Mail.MailPriority.Normal;
  
              oMailMessage.DeliveryNotificationOptions =
                  System.Net.Mail.DeliveryNotificationOptions.OnSuccess ;
              string strRootRelativePathName = "~/Attachments/Attachment.png";
              string strPathName = Server.MapPath(strRootRelativePathName);
  
              if (System.IO.File.Exists(strPathName))
              {
                  System.Net.Mail.Attachment oAttachment =
                      new System.Net.Mail.Attachment(strPathName);
  
                  oMailMessage.Attachments.Add(oAttachment);
              }
              System.Net.Mail.SmtpClient oSmtpClient =
                  new System.Net.Mail.SmtpClient();
              oSmtpClient.Timeout = 100000;
              oSmtpClient.EnableSsl = false;
              oSmtpClient.Send(oMailMessage);
  
              string strInformationMessage =
                  "Your Email Has been successfully sent";
              lblError.Visible = true;
              lblError.Text = strInformationMessage;
          }
          catch (System.Exception ex)
          {
              DisplayErrorMessage(ex.Message);
          }
      }
  }
  protected virtual void DisplayErrorMessage(string message)
  {
      lblError.Visible = true;
  
      lblError.Text =
          string.Format("&lt;div class='error'&gt;{0}&lt;/div&gt;", message);
  }
  </code></pre>