I'm trying to dynamically create pdf, write it to the Response.OutputStream, and attach it to a FireMail PlainTextMessage object.
Is this possible? The documentation only shows writing a filestream from a hard copy file. Is there anything that shows how to write a MemoryStream (or anything that is not a FileStream)?
Can you use a memorystream object for an attachment
Re: Can you use a memorystream object for an attachment
Support · Jun 30, 2006The Attachment object contructor can take either a byte array, a string (filepath) or it can take a System.IO.Stream. The Stream object does not need to be a FileStream but rather could be any type derived form the System.IO.Stream class (i.e MemoryStream).
One additional thing to keep in mind here is that you need to make sure that you seek back to the beginning of the Stream before passing it into the Attachment constructor.
Thanks,
ceTe Software Support Team