views:

537

answers:

2

I recently had an issue after upgrading my .net framework to 4.0 from 3.5:

System.Net.Mail.SmtpException: Failure sending mail. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Net.Base64Stream.EncodeBytes(Byte[] buffer, Int32 offset, Int32 count, Boolean dontDeferFinalBytes, Boolean shouldAppendSpaceToCRLF) at System.Net.Base64Stream.Write(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Mime.MimePart.Send(BaseWriter writer) at System.Net.Mime.MimeMultiPart.Send(BaseWriter writer) at System.Net.Mail.Message.Send(BaseWriter writer, Boolean sendEnvelope) at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace ---

I read this connect bug listing here: http://connect.microsoft.com/VisualStudio/feedback/details/544562/cannot-send-e-mails-with-large-attachments-system-net-mail-smtpclient-system-net-mail-mailmessage.

If anyone cares about this issue, please vote for it on Connect, so it will be fixed sooner.

+4  A: 

This is a confirmed bug in .net v4.0.

Please click the link in the question and vote to get the issue fixed.

JL
voted !!have you tried work arround suggested in the link?
Pragnesh Patel
hi Prag, thats my workaround. I see you requested files from me, which I sent.
JL
kool. Thanks for the file.
Pragnesh Patel
+5  A: 

The bug has been patched: https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=30226

Title: KB2183292

Release Date: 7/21/2010

Size: 8.58 MB

Version: Hotfix

Category: Build

Description QFE: System.Net.Mail - SmtpClient class throws exceptions if file attachment is > over 3MB

Andy May
I ran this x64 hotfix on a few servers and it takes like 5 minutes to install this little 2MB patch. Any one else experience that?
Gordon Bell
It took a long time to install on my server as well.
Andy May