Powershell Error – Index was outside the bounds of the array when using System.Net.Mail Class with Send-MailMessage cmdlet

Are you using the System.Net.Mail to send File Attachments? Is the file attachment above 3MB?

If yes; you have just found out the reason for the error. The System.Net.Mail Class throws an exception if a file attachment is over 3MB

Microsoft has a patch available which solves this issue


If you have any issues downloading the file; you may post your comment on this post.

Once the patch is applied; you should now be able to send large attachments using your Powershell Send-MailMessage cmdlet.

Please ensure that you use the -UseSSL in your cmdlet. If you leave out -UseSSL; you are most likely to encounter the below error

Send-MailMessage : The operation has timed out.