I want to send an attachment in an email, SO for that I want to save the attachment file in a folder first.

> 
> So what's happening with my current code is, the mail is going with attachment but my file is not getting saved into the `ATTACHMENT` folder.
> 
> 
> 

here is the code i tried

```
for (int i = 0; i < table.Rows.Count; i++)
        {
            if (1 == 1)
            {
                string StrPriBody = "This is a test mail for checking notification.";

                MailMessage mail = new MailMessage();
                mail.Subject = "Daily Holding followup scheduler";
                mail.From = new System.Net.Mail.MailAddress("autosupport@powersoft.in");
                SmtpClient smtp = new SmtpClient();
                smtp.Timeout = 1000000;
                smtp.Port = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["Port"]);
                smtp.UseDefaultCredentials = true;
                smtp.Host = System.Configuration.ConfigurationManager.AppSettings["MailHost"];
                smtp.Credentials = new NetworkCredential(mail.From.ToString(), "PS123456");
                smtp.EnableSsl = true;
                mail.To.Add(new MailAddress("abc@test.com"));
                mail.IsBodyHtml = true;
                mail.Body = StrPriBody;

                DataSet ds = new DataSet();
                ds.Tables.Add(table);
                ds.Tables[0].TableName = "Post sale follow up entries auto mailer";

                SaveFileDialog save = new SaveFileDialog();
                save.InitialDirectory = "\\Attachment";
                save.RestoreDirectory = true;

                ExcelLibrary.DataSetHelper.CreateWorkbook("Employee_Details.xls", ds);

                mail.Attachments.Add(new Attachment("Employee_Details.xls"));

                smtp.Send(mail);

                foreach (Attachment attachments in mail.Attachments)
                {
                    attachments.Dispose();
                }

```