When I try to send an email with an attachment with multiple recipients through my C # code, I get a System.Net.Mail.SmtpException message that says, "Failed to send mail." Internal exception: "One of the threads is already in use and cannot be reset at the beginning."
I understand that such a mistake may be due to my attachment. I created my binding in another class since -
Attatchment file; string fileContents = File.ReadAllText(fileName); file = Attachment.CreateAttachmentFromString(fileContents, fileName);
I send it in this format to my class, which sends an email. In this class, the following happens:
try { email.Subject = subject; email.Body = body; if (file != null) { email.Attachments.Add(file); } _smtpClient.Send(email); } catch { mailSent = false; }
Mail is always sent to the first recipient, but not for all others. Any ideas why this could be happening?
source share