title: Error "A recipient must be specified" occurred while sending mail in c#
body: <p>I am trying to send mail with multiple attachment in c# but I am getting this error </p>
  
  <blockquote>
    <p>A recipient must be specified while sending mail</p>
  </blockquote>
  
  <p>Here is my code for sending mail with attachment</p>
  
  <pre><code>            string to = txtto.Text; //To address        
              string from = "xxx@mail.com"; //From address     
  
              MailMessage message = new MailMessage();
              message.From = new MailAddress(from);
  
  
              if (fileuploading.HasFile)//Attaching document    
              {
                  string FileNamess = fileuploading.PostedFile.FileName;
                  string FileName = Path.GetFileName(fileuploading.PostedFile.FileName);
  
  
                  message.Attachments.Add(new System.Net.Mail.Attachment(fileuploading.PostedFile.InputStream,FileName));
  
              }
  
              string mailbody = editor.Text;
              message.Subject = txtsubject.Text;
              message.Body = mailbody;
              message.BodyEncoding = Encoding.UTF8;
              message.IsBodyHtml = true;
  
  
              SmtpClient client = new SmtpClient("smtp.gmail.com", 587); //Gmail smtp        
              System.Net.NetworkCredential basicCredential1 = new
              System.Net.NetworkCredential("xxx@mail.com","xxxxx");
              client.EnableSsl = true;
              client.UseDefaultCredentials = false;
              client.Credentials = basicCredential1;
  
              try
              {
                  client.Send(message);
              }
  
              catch (Exception ex)
              {
                  throw ex;
              }
  </code></pre>