.NET: Problems creating email attachment from MemoryStream.
- by David
Hi all
I'm using the following method to create an attachment from a MemoryStream:
public void AddAttachment(Stream stream, string filename, string mimeType)
{
byte[] buffer = ((MemoryStream) stream).GetBuffer();
Attachment attachment = new Attachment(stream, filename, mimeType);
_mail.Attachments.Add(attachment);
}
Note that the first…