简体   繁体   中英

C# Multiple file attachments with email not working

I am attaching multiple PDF on email not working,When i attached single file its working but when i attached two file i am getting error " Failure sending mail " Below is my code

MailMessage objMailMessage = new MailMessage();
objMailMessage.From = new MailAddress(from, senderName);
objMailMessage.To.Add(new MailAddress(to));
objMailMessage.Subject = addSub + " " + (string)mailParameters[1];
objMailMessage.Body = (string)mailParameters[2];
objMailMessage.IsBodyHtml = isHTML; 
objMailMessage.Attachments.Add(new Attachment("my file 1 path"));
objMailMessage.Attachments.Add(new Attachment("my file 1 path"));

You seem to be attaching the same file twice ("my file 1 path"). Attach two or more different files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM