asp.net - ASPNet EMail attachment from SQL BLOB -
We are storing scheduled email notification in SQL Server 2005. Email notifications include 0 - 3 attachments different file types . I have a VB.net Windows service that runs a 'x' number of minutes, populates the dataset with email notifications from the SQL server, creates emails, and sends them through ASPnet emails.
Due to adding an attachment to a blob, the time to send e-mail is timed, even if the attachment is only a 15 byte text file. Hardcoding paths directly to the file works fine. I have tried many ways and it can not be found right.
Hmm, I did the same thing for each of my attachments I used to call data in a binary column , And a separate column in which the file size is placed in bytes. I wrote something to get from the database (using SQL Commands and SQLDitard classes):
attachment = new byte [size]; SqlReader.GetBytes (sqlReader.GetOrdinal ("Attachments"), 0, Attachments, 0, Size); System.IO.MemoryStream s = New System.IO.MemoryStream (attachment, true); S.Write (attachment, 0, attachment length);
Also connected to a mailmassage class (mm to minimize);
System.IO.MemoryStream s = new system Io Memorystream (attachment, false); Attachment Attached = New Attachment (S, "Some File Name"); Mm.Attachments.Add (attached);
Perhaps these extracts will help! I've pulled the code from two different custom sections, so it's a little stuck with the memorystream object in every extract.
Comments
Post a Comment