title: Convert VB to C#: Email sending routine
body: <p>I am new to C# and have a VB sub routine for sending emails.</p>
  
  <p>I am not sure how to convert to C#, can someone please help me?</p>
  
  <p>here is the sub:</p>
  
  <pre><code>Sub SendAdditionalEmails()
      Dim strDelimeter As String = ","
      Dim strEmailResult As String = ""
      'make sure they dont put a comma on the end (To)
      If InStr(Len(txtTo.Text) - 1, txtTo.Text, ",") &gt; 0 Then
          txtTo.Text = Mid(txtTo.Text, 1, Len(txtTo.Text) - 1)
      End If
  
      'put the emails into the array
      Dim splitout As Array = Split(txtTo.Text, strDelimeter)
      Dim i As Integer = 0
      Me.pnlError.Visible = False
      For i = 0 To UBound(splitout)
          'loop through all the emails and send them ...
          '-------------------------------------------------------------------
          If SendEmail(splitout(i), txtSubject.Text, txtMessage.Text) = True Then
              txtTo.Text = ""
              txtSubject.Text = ""
              txtMessage.Text = ""
              chkTenantBrochure.Checked = False
              lblSuccess.Text = lblSuccess.Text &amp; "An email was sent to: " &amp; splitout(i) &amp; "&lt;br&gt;"
              lblSuccess.Visible = True
          Else
              Me.pnlError.Visible = True
              lblError.Text = lblError.Text &amp; "An email did not get sent to: " &amp; splitout(i) &amp; "&lt;br&gt;"
              lblError.Visible = True
          End If
  
      Next
  End Sub
  </code></pre>