How to read a file in and email it

  • Thread starter Thread starter Robert
  • Start date Start date
R

Robert

How can I read a file in, make the contents of the file
the body of an email message and then email it?

I want to read an HTML file in and send an HTML formatted
email message.
 
* "Robert said:
How can I read a file in, make the contents of the file
the body of an email message and then email it?

I want to read an HTML file in and send an HTML formatted
email message.

For reading the file, have a look at the classes in the 'System.IO'
namespace, namely 'StreamReader'.

For mailing the text, have a look at the 'System.Web.Mail' namespace
(this will require a reference to "System.Web.dll").
 
I've been looking at StreamReader and it is the syntax
that I am having trouble with.

-----Original Message-----
* "Robert" <[email protected]> scripsit:

For reading the file, have a look at the classes in the 'System.IO'
namespace, namely 'StreamReader'.

For mailing the text, have a look at
the 'System.Web.Mail' namespace
 
Hi Robert,

You only have to read it as one long string.

And therefore is with the streamreader one instruction.

"ReadToEnd"

Cor
 
* "Robert said:
I've been looking at StreamReader and it is the syntax
that I am having trouble with.

\\\
Dim sr As New System.IO.StreamReader("C:\foo.txt")
Dim s As String = sr.ReadToEnd()
sr.Close()
///
 
Back
Top