not able to send attachment to multiple recipients

KAOSXXI

New Member
I have one form through which ,Sender text his email-id and password and selects attachment using fileupload,recipients's email id i am getting from database table,email is reaching to recipients fine..but problem is that when i attach a attachment ,attachment's size goes 0 except 1st email-id ,which i am getting from table....i have pasted code.. \[code\]foreach (string email_to in list_emails){ MailMessage mail = new MailMessage(); mail.To.Add(email_to); mail.Subject = "UPDATES FROM ATTENDANCE S/W"; mail.From = new MailAddress(txtFrom.Text.ToString()); mail.Body = txtMessage.Text; if (FileUpload1.HasFile) { string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); Attachment myAttachment = new Attachment(FileUpload1.FileContent, fileName); mail.Attachments.Add(myAttachment); } SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential(txtFrom.Text.ToString(), txtPasswd.Text.ToString()); smtp.EnableSsl = true; smtp.Send(mail);}\[/code\]
 
Back
Top