i know the mail attachment doesn't allow stream as an attachment, i found a work around...
Public Class IAMailAttachment
''' i had to provide the original set of constructors,
''' because chances were someone might want to use file names
Public Sub New(ByVal fileName As String)
Public Sub New(ByVal fileName As String, ByVal encoding As MailEncoding)
Public Sub New(ByVal fileData As Byte(), ByVal extension As String)
Public Sub New(ByVal ioStream As Stream, ByVal extension As String)
''' shared method expects a stream, which it reads into a bytes, and then calls the createMailAttachment method to
''' actually create a temporary file
Private Shared Function createMailAttachmentFromStream(ByVal ioStream As Stream, ByVal extension As String) As String
Dim bytesToRead(ioStream.Length - 1) As Byte
ioStream.Read(bytesToRead, 0, bytesToRead.Length)
Return createMailAttachmentFromBytes(bytesToRead, extension)
''' shared method expects byte array, and the extension of the file expected by the mail
''' it then creates a file under temporary folder of the user. [we can't use any other folder because we might not have access to it]
''' it then creates file, writes the bytes to it, and then make sure its close.
''' finally it returns the file name that was jus created.
Private Shared Function createMailAttachmentFromBytes(ByVal fileData As Byte(), ByVal extension As String)
Dim fileToCreate = New StringBuilder(System.Environment.GetEnvironmentVariable("TEMP")). _
Dim streamToWrite As FileStream = File.Create(fileToCreate, fileData.Length)
streamToWrite.Write(fileData, 0, fileData.Length)
Sai aka Dj Vibe [ djvibe_alb ( at ) hotmail dot com ],