This method on the MailMessage class looks like it lets you add an attachment using a stream, but it appears that this just adds the stream to the underlying attachments ArrayList which is later iterated into an Attachment variable whereupon it bombs with a type cast exception. Better to drop this overload I think and force the user of the AddAttachment(Attachment ) method and use new Attachment(Stream s, string, filename)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This method on the MailMessage class looks like it lets you add an attachment using a stream, but it appears that this just adds the stream to the underlying attachments ArrayList which is later iterated into an Attachment variable whereupon it bombs with a type cast exception. Better to drop this overload I think and force the user of the AddAttachment(Attachment ) method and use new Attachment(Stream s, string, filename)
Thanks! I'll review this code and place it in my last release.