File name in SmtpContent

May 11, 2014 at 12:36 PM

I wanted to ask, is it possible to add SmtpContent without using SmtpContent.LoadFileData method? I want to add attachments to message I am about to send, but I don't want to take them from hard drive but from database. LoadFileData gets file name but LoadData gets only byte[] and then when I try to send an email, attachment is without file name, which is not good. So if it's not possible could You maybe add feature like LoadData(byte[],fileName) or something like this?
May 12, 2014 at 4:22 AM
Try this.
var mg = new SmtpMessage();
var content = mg.Contents[0];
content.ContentType.Name = "MyPhoto.png";
content.ContentDisposition.FileName = "MyPhoto.png";
I consider to add feature something intuitive way like you say.

May 12, 2014 at 11:32 AM

Thank You, that works like charm :).