title: Sending attachments through gmail not working with certain types - Why?
body: <p>Why can't I send xls,doc and other files - it does work for jpg,txt and others.</p>
  
  <pre><code>private void BuildAndSend(string pTo,string pCC,string pSubject,string pBody)
          {
              // building the mail
              System.Net.Mail.MailAddress toAddress = new System.Net.Mail.MailAddress(pTo);
  
              System.Net.Mail.MailAddress fromAddress = new System.Net.Mail.MailAddress("mymail@gmail.com");
              System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage(fromAddress, toAddress);
              mm.Subject = pSubject ;
              mm.Body = pBody;
  
              System.Net.Mail.MailAddress cc = new System.Net.Mail.MailAddress(pCC);
              mm.CC.Add(cc);
  
              addAttachments(mm);
              mm.IsBodyHtml = true;
              mm.BodyEncoding = System.Text.Encoding.UTF8;
  
              //sending the mail
              sendMail(mm);
          }
  
          private void addAttachments(System.Net.Mail.MailMessage mm)
          {
              string attachmentFile;
              for (int i = 0; i &lt; lstAttachments.Items.Count ; i++)
              {
  
                  string fileFullName = pullDictionary[i];
                  attachmentFile = fileFullName;
                  System.Net.Mail.Attachment mailAttachment = new System.Net.Mail.Attachment(attachmentFile);
                  mm.Attachments.Add(mailAttachment);
  
              }
  
          }
  
          private void sendMail(System.Net.Mail.MailMessage mm)
          {
              try
              {
                  // loging in into sending user account
                  string smtpHost = "smtp.gmail.com";
                  string userName = "mymail@gmail.com";//sending Id
                  string password = "mypass";
                  System.Net.Mail.SmtpClient mClient = new System.Net.Mail.SmtpClient();
                  mClient.Port = 587;
                  mClient.EnableSsl = true;
                  mClient.UseDefaultCredentials = false;
                  mClient.Credentials = new NetworkCredential(userName, password);
                  mClient.Host = smtpHost;
                  mClient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                  mClient.Send(mm);
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message);
              }
          }
  </code></pre>
  
  <p>if you can show me another way to send these files it will be great as well</p>