Hotfix: Failure Sending mail error with System.Net.Mail (.Net Framework 4.0) while sending large attachment

Recently one of my customer ran into an issue with his application used to send email messages using System.Net.Mail.SmtpClient (SNM) API. He used Visual Studio 2010 and .NET Framework 4.0. It’s a pretty simple code,

//Sample C# code snippet using System.Net.Mail API
SmtpClient MyClient = new SmtpClient("mail_server");
MyClient.Credentials = new System.Net.NetworkCredential("User", "Password", "Domain");
MailMessage MyMsg = new MailMessage("fromuser", "touser", "Testing Attachment", "Testing");
Attachment MyAttachment = new Attachment(@"attachmentfile");
MyMsg .Attachments.Add(MyAttachment );
MyClient.Send(MyMsg );

Using the above code, whenever he adds the attachment size is larger than 3 MB and tries to send the message. It fails with the following a exception System.Net.Mail.SmtpException and error message “Failure sending mail”. Also during troubleshooting i noticed that i generates a inner exception System.IndexOutOfRangeException with the error message “Index was outside the bounds of array”. In the application he also failed to specify the TransferEncoding property of the attachment.

In this customer scenario, recommended him to try with TransferEncoding property with QuotedPrintable worked for him. We tried it like,
MyAttachment.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;

You can find the following support knowledgebase article which talks about the issue and provides resolution to overcome the issue. 

Also there is a hotfix available to overcome this issue. Please make sure that you must have .NET Framework 4.0 installed to apply this hotfix. To download this hotfix, you can visit following Microsoft website: