Powered By Blogger

Thursday, August 7, 2008

SMTP mailing Attachment from Database

obj.gettable("select filename,fileExtn,fileContent from Files where fileId=@fileId");
string filename = obj.dt.Rows[0][0].ToString();
string ext = obj.dt.Rows[0][1].ToString();
byte[] bytFile = (byte[])obj.dt.Rows[0][2];
MemoryStream stream = new MemoryStream(bytFile);
Attachment att = new Attachment(stream, filename.ToString(), "application/msword");

No comments: