title: The parameter 'addresses' cannot be an empty string
body: <p>I am trying to send an email in ASP.NET using the <a href="https://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient(v=vs.110).aspx" rel="nofollow noreferrer"><code>System.Net.Mail.SmtpClient</code></a> class.</p>
  <p>However I am getting the following exception message:</p>
  <blockquote>
  <p>The parameter 'addresses' cannot be an empty string. Parameter name: addresses</p>
  </blockquote>
  <p>This is my send email code:</p>
  <pre><code>private void SendEmailUsingGmail(string toEmailAddress)
  {
      try
      {
          SmtpClient smtp = new SmtpClient();
          smtp.Credentials = new NetworkCredential(&quot;keysketyyyy@gmail.com&quot;, 
           &quot;sdsdasd&quot;);
          smtp.Port = 587;
          smtp.Host = &quot;smtp.gmail.com&quot;;
          smtp.EnableSsl = true;
          MailMessage message = new MailMessage();
          message.From = new MailAddress(&quot;keysketyyy@gmail.com&quot;);
          message.To.Add(toEmailAddress);
          message.Subject = &quot;Write your email subject here&quot;;
          message.Body = &quot;write the content of the email here&quot;;
          smtp.Send(message);
      }
      catch (Exception ex)
      {
          Response.Write(&quot;Error occured: &quot; + ex.Message.ToString());
      }
  }
  </code></pre>
  <p>The exception is being caught in the <code>SendEmailUsingGmail</code> catch block.</p>
  <p>This is the calling code:</p>
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {            
     string connStr = ConfigurationManager.ConnectionStrings[&quot;mydms&quot;].ConnectionString;
     SqlConnection mySQLconnection = new SqlConnection(connStr);
     if (mySQLconnection.State == ConnectionState.Closed)
     {
         mySQLconnection.Open();
         for (int i = 0; i &lt; Repeater2.Items.Count; i++)
         {
             DropDownList DropDownListcontrol = ((DropDownList)Repeater2.Items[i].FindControl(&quot;DropDownList4&quot;));
             Label DocId = ((Label)Repeater2.Items[i].FindControl(&quot;DocId&quot;));
                    
             SqlCommand cmd = new SqlCommand(&quot;approveddd&quot;, mySQLconnection);
             cmd.CommandType = CommandType.StoredProcedure;
  
             cmd.Parameters.Add(&quot;@DocID&quot;, SqlDbType.Int).Value = Convert.ToInt32((DocId.Text));
  
             cmd.Parameters.Add(&quot;@ApproveID&quot;, SqlDbType.Int).Value = Convert.ToInt32(DropDownListcontrol.SelectedValue);
             cmd.Parameters.Add(&quot;@ApproveBy&quot;, SqlDbType.VarChar, 50).Value = (Session[&quot;Login2&quot;]);
              try
              {
                  cmd.ExecuteNonQuery();
                  string emailId = ((Label)Repeater2.Items[i].FindControl(&quot;Label2&quot;)).Text;
                  SendEmailUsingGmail(emailId);
               }
               catch (Exception ex)
               {
                   Supvisor.Text=(ex.Message);
               }
               cmd.ExecuteNonQuery();
               //UPDATE APPPROVEID IN DOCUMENTINFO TABLE
               //DMSLIB.Doc myDoc = new DMSLIB.Doc();
               //myDoc.MarkDocAs(Convert.ToInt16(DocId.Text), 
               Convert.ToInt32(DropDownListcontrol.SelectedValue));
          }
  
      }
      else
      {
           Supvisor.Text = &quot;Error&quot;;
      }
      if (mySQLconnection.State == ConnectionState.Open)
      {
           mySQLconnection.Close();
      }
   }
  </code></pre>
  <p>When an admin approves / rejects a document the data is saved into database like this:</p>
  <pre><code>SeqNo   DocID   ApproveID   ApproveBy
  82      20      3           john
  83      21      1           john
  84      18      2           kety
  85      19      1           emel
  </code></pre>
  <p>I also send an email when admins click a button, the email is sent to respective email ids like this, as I show in a repeater table:</p>
  <pre><code> DocID  DocName Uplaodedfile    UserEmail           DocType DepType ApproveID
   1      ABC     def.pdf         abcdef@gmail.com    pdf     hr      (In this i set dropdown values are (approve/reject/pending)
  
    
  </code></pre>