i am using mail class to send email with attachment as image to multiple recipients. but the problem is as email is sent to first recipient it is throwing an exception that "image is being used by another process".. how this can be solved..
i am getting users in listitem as:
foreach (ListItem item in lstboxlist.Items)
{
to = Convert.ToString(item);
select_theme_tosend(to, sub);
}
and i am sending mail to users as:
string source_theme = theme;
string dest_theme_path = "xxx";
if (File.Exists(dest_theme_path))
{
File.Delete(dest_theme_path);
}
File.Copy(source_theme, dest_theme_path);
xmlDoc.Load(theme);
XmlNode node = null;
SendMail_Html send_html = new SendMail_Html ();
MailMessage mail = new MailMessage();
Attachment footer_att = null;
Attachment header_att = null;
Attachment other_att = null;
mail.Attachments.Add(other_att);
}
xmlDoc.Save(theme);
StreamReader strm_rdr = new StreamReader(theme);
string theme_text = strm_rdr.ReadToEnd();
SendMail send_mail = new SendMail();
send_html.sent_htmlmail1(to, theme_text, subject, footer_att, header_att, other_att);
mail.Dispose();
// File.Delete(header_path);
// File.Delete(other_imagepath);
// File.Delete(foot_image_path);
}
if i uncomment last line it is showing an error on sending mail to second address as: "specified file cannot found"... what should i do to send multiple emails... please help...