Hi
Can you help me?
I want to store a file of any description or format (from a hard disk)
into memory in VB.NET (using ASP.NET).
Then I want to use this datastructure in memory (containing the file)
to be used for the construction of a SMTP message.
What I am doing with SMTP at the moment is reading files off the hard
disk every time when constructing an attachment for a message (see
below code). This isn't very efficient in my situation, whereby many
people are being sent exactly the same attachment in different
messages. Basically I am trying to avoid multiple disk reads.
In summary then, can anybody give me any ideas on:
a) How to store a file (stored into memory) using VB.Net (inc
filename)
b) How to write out to memory and put it in a SMTP mail attachment?
I would be greatful for any pointers, documentation, or some sample
code(!). I have looked around but I am slightly confused.
Many thanks!
Alex
'---SAMPLE CODE BEGIN----
'NOTE filepath is the filepath of a file on a hard disk
Dim objMessage As New System.Web.Mail.MailMessage
'Code stripped out for simplicity
objMessage.Attachments.Add(New MailAttachment(filepath)
'Code stripped out for simplicity
SmtpMail.Send(objMessage)
'---SAMPLE CODE END----