Tuesday, May 29, 2012

.NET 4.0 Fails When sending emails with attachments larger than 3MB



SMTPClient class throws "System.IndexOutOfRangeException: Index was outside the bounds of the array." exception while sending mails with attachment file size more than 3MB.
Recently I encounter a bug in .net while testing mail sending feature in our app. Upon little googling, found that it is a bug in SMTPClient class available in .NET 4.0.

Check below link for details of the bug:
https://connect.microsoft.com/VisualStudio/feedback/details/620785/important-bug-system-net-mail-smtpclient-send-mailmessage-causes-index-was-outside-the-bounds-of-the-array-because-of-the-content-of-an-attachment?wa=wsignin1.0

http://stackoverflow.com/questions/9703675/random-index-was-outside-the-bounds-of-the-array-as-an-smtpexception

Below is the link for Hot fix for .NET Framework to fix this issue:
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=30226




No comments:

Post a Comment