473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

sending html formatted mail through vb .net

The following code works fine:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")

htmstring = sr.ReadToEnd()

msg.Body = htmstring

msg.BodyFormat = MailFormat.Html ' as opposed to mailformat.text

However, if the htm file has images, they do not go along with the text
stream. How can I include the images that the htm file uses?

Thanks for any help.

Bernie Yaeger


Nov 20 '05 #1
14 1222
Bernie,

Images would have to be embedded in attachments of the mail message itself,
if you look at spam, they don't include the images in the message itself,
but on a public webserver outside of it.

To send the messages themselves with images is a huge bandwidth hog on mail
servers.

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...
The following code works fine:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")

htmstring = sr.ReadToEnd()

msg.Body = htmstring

msg.BodyFormat = MailFormat.Html ' as opposed to mailformat.text

However, if the htm file has images, they do not go along with the text
stream. How can I include the images that the htm file uses?

Thanks for any help.

Bernie Yaeger

Nov 20 '05 #2
Bernie,

* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")

htmstring = sr.ReadToEnd()

msg.Body = htmstring

msg.BodyFormat = MailFormat.Html ' as opposed to mailformat.text

However, if the htm file has images, they do not go along with the text
stream. How can I include the images that the htm file uses?


I didn't test it, but maybe it will work better with Indy:
<http://www.indyproject.org/indy.html>.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #3
From a practical standpoint doesn't this look like streamreader is the
cause?

I could be out to lunch but it would have to "read the stream" and notice
there was a reference to a supported graphic type and decide to load that
too despite it being in a "different" stream (does it open it read-only?)
and then it encounters what looks like a reference to a 20 minute video file
and so it reads that too. :-)

I'm not certain I want streamreader to be that clever,
Tom

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote...
Bernie,

* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")

htmstring = sr.ReadToEnd()

msg.Body = htmstring

msg.BodyFormat = MailFormat.Html ' as opposed to mailformat.text

However, if the htm file has images, they do not go along with the text
stream. How can I include the images that the htm file uses?


I didn't test it, but maybe it will work better with Indy:
<http://www.indyproject.org/indy.html>.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!

Nov 20 '05 #4
Tx Herfried - looks like an interesting component.

Bernie

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
Bernie,

* "Bernie Yaeger" <be*****@cherwellinc.com> scripsit:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")

htmstring = sr.ReadToEnd()

msg.Body = htmstring

msg.BodyFormat = MailFormat.Html ' as opposed to mailformat.text

However, if the htm file has images, they do not go along with the text
stream. How can I include the images that the htm file uses?


I didn't test it, but maybe it will work better with Indy:
<http://www.indyproject.org/indy.html>.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!

Nov 20 '05 #5
Thanks CJ - I think I have to answer from your suggestions - I can call each
image from an internet site - eg, http:// etc - where the images reside.

Thanks again,

Bernie

"CJ Taylor" <cj@herfriedslovechild.org> wrote in message
news:cFs0c.425394$I06.4763428@attbi_s01...
Bernie,

Images would have to be embedded in attachments of the mail message itself, if you look at spam, they don't include the images in the message itself,
but on a public webserver outside of it.

To send the messages themselves with images is a huge bandwidth hog on mail servers.

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...
The following code works fine:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")

htmstring = sr.ReadToEnd()

msg.Body = htmstring

msg.BodyFormat = MailFormat.Html ' as opposed to mailformat.text

However, if the htm file has images, they do not go along with the text
stream. How can I include the images that the htm file uses?

Thanks for any help.

Bernie Yaeger


Nov 20 '05 #6
* "Tom Leylan" <ge*@iamtiredofspam.com> scripsit:
From a practical standpoint doesn't this look like streamreader is the
cause?
Yes and no. The HTML file doesn't include the graphics files, it only
references them.
I could be out to lunch but it would have to "read the stream" and notice
there was a reference to a supported graphic type and decide to load that
too despite it being in a "different" stream (does it open it read-only?)
and then it encounters what looks like a reference to a 20 minute video file
and so it reads that too. :-)

I'm not certain I want streamreader to be that clever,


'StreamReader' isn't that clever, but you can provide a class
'TomsToolbox.HtmlStreamReader' or something similar :-).

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #7
Perhaps I misunderstood...

Is there a replacement for StreamReader in the Indy library which analyzes
the file it is reading and decides which files to imbed? It could be I have
it entirely wrong but it seems... well let me use the term "unlikely."

If it has such a feature would you let us know?

Again... I'm probably phrasing things wrong. What makes you think that Indy
might be able to produce alternative results... that might be what I'm
trying to ask.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
* "Tom Leylan" <ge*@iamtiredofspam.com> scripsit:
From a practical standpoint doesn't this look like streamreader is the
cause?


Yes and no. The HTML file doesn't include the graphics files, it only
references them.
I could be out to lunch but it would have to "read the stream" and notice there was a reference to a supported graphic type and decide to load that too despite it being in a "different" stream (does it open it read-only?) and then it encounters what looks like a reference to a 20 minute video file and so it reads that too. :-)

I'm not certain I want streamreader to be that clever,


'StreamReader' isn't that clever, but you can provide a class
'TomsToolbox.HtmlStreamReader' or something similar :-).

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!

Nov 20 '05 #8
Exactly.

no problem,.

CJ
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:u3*************@TK2MSFTNGP11.phx.gbl...
Thanks CJ - I think I have to answer from your suggestions - I can call each image from an internet site - eg, http:// etc - where the images reside.

Thanks again,

Bernie

"CJ Taylor" <cj@herfriedslovechild.org> wrote in message
news:cFs0c.425394$I06.4763428@attbi_s01...
Bernie,

Images would have to be embedded in attachments of the mail message

itself,
if you look at spam, they don't include the images in the message itself, but on a public webserver outside of it.

To send the messages themselves with images is a huge bandwidth hog on

mail
servers.

"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...
The following code works fine:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")

htmstring = sr.ReadToEnd()

msg.Body = htmstring

msg.BodyFormat = MailFormat.Html ' as opposed to mailformat.text

However, if the htm file has images, they do not go along with the text stream. How can I include the images that the htm file uses?

Thanks for any help.

Bernie Yaeger



Nov 20 '05 #9
Hi Tom,

Frankly, I love your idea - but the streamreader (or component) would have
to be pretty smart to do what you suggest. But the more I think of it, yes,
it should be able to! Great idea.

Bernie

"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:e%****************@TK2MSFTNGP12.phx.gbl...
Perhaps I misunderstood...

Is there a replacement for StreamReader in the Indy library which analyzes
the file it is reading and decides which files to imbed? It could be I have it entirely wrong but it seems... well let me use the term "unlikely."

If it has such a feature would you let us know?

Again... I'm probably phrasing things wrong. What makes you think that Indy might be able to produce alternative results... that might be what I'm
trying to ask.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
* "Tom Leylan" <ge*@iamtiredofspam.com> scripsit:
From a practical standpoint doesn't this look like streamreader is the
cause?
Yes and no. The HTML file doesn't include the graphics files, it only
references them.
I could be out to lunch but it would have to "read the stream" and notice there was a reference to a supported graphic type and decide to load that too despite it being in a "different" stream (does it open it read-only?) and then it encounters what looks like a reference to a 20 minute
video file and so it reads that too. :-)

I'm not certain I want streamreader to be that clever,


'StreamReader' isn't that clever, but you can provide a class
'TomsToolbox.HtmlStreamReader' or something similar :-).

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!


Nov 20 '05 #10
Hi Bernie,

I fear that I've been misunderstood. No problem though as decades of
misunderstandings have made me quite immune to this :-) But... how would it
"know" which things in the text file (and don't for a moment think that a
file with an HTM extension isn't a text file) should read using the same
settings as it used to read the text file?

You can't read any old graphics format with the same settings as you read a
text file. They aren't the same format, you may not have the proper
permissions, you didn't explain what to do if one of the potentially many
"subfiles" turns out to not be available, etc. Try it from this
direction... it encounters ".pdf" as as an extension... and? What do you
hope it will do? Use your copy of the .pdf reader, the one you think you
the client has? Some version in cyberspace? It had better fail just to
behave normally :-)

It not only can't if it ever could it shouldn't... :-)

I'm still trying to figure out why Herfried thought that some other TCP/IP
library would make a difference. It's not a bad idea, I'm just wondering
how people's minds work. These are computers... why not suppose that cars
know where we want to go and have them simply drive us there?
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
Hi Tom,

Frankly, I love your idea - but the streamreader (or component) would have
to be pretty smart to do what you suggest. But the more I think of it, yes, it should be able to! Great idea.

Bernie

"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:e%****************@TK2MSFTNGP12.phx.gbl...
Perhaps I misunderstood...

Is there a replacement for StreamReader in the Indy library which analyzes the file it is reading and decides which files to imbed? It could be I

have
it entirely wrong but it seems... well let me use the term "unlikely."

If it has such a feature would you let us know?

Again... I'm probably phrasing things wrong. What makes you think that

Indy
might be able to produce alternative results... that might be what I'm
trying to ask.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
* "Tom Leylan" <ge*@iamtiredofspam.com> scripsit:
> From a practical standpoint doesn't this look like streamreader is the > cause?

Yes and no. The HTML file doesn't include the graphics files, it only
references them.

> I could be out to lunch but it would have to "read the stream" and

notice
> there was a reference to a supported graphic type and decide to load

that
> too despite it being in a "different" stream (does it open it

read-only?)
> and then it encounters what looks like a reference to a 20 minute

video
file
> and so it reads that too. :-)
>
> I'm not certain I want streamreader to be that clever,

'StreamReader' isn't that clever, but you can provide a class
'TomsToolbox.HtmlStreamReader' or something similar :-).

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!



Nov 20 '05 #11
Cor
Hi Bernie,
The following code works fine:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")


Did you test this also with webpages with frames?

Just curious if this works, I am asuming that this does not work also?

Cor

Nov 20 '05 #12
Hi Tom,

Why so difficult? Parsing a string isn't all that hard. How many key
strings need the component parse - .pdf, .gif, .png, .jpg - then, too,
<http, <href and various other tags, all of which is done now by the html
spec.

No, you're not giving yourself enough credit :-)

Bernie

"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:um**************@tk2msftngp13.phx.gbl...
Hi Bernie,

I fear that I've been misunderstood. No problem though as decades of
misunderstandings have made me quite immune to this :-) But... how would it "know" which things in the text file (and don't for a moment think that a
file with an HTM extension isn't a text file) should read using the same
settings as it used to read the text file?

You can't read any old graphics format with the same settings as you read a text file. They aren't the same format, you may not have the proper
permissions, you didn't explain what to do if one of the potentially many
"subfiles" turns out to not be available, etc. Try it from this
direction... it encounters ".pdf" as as an extension... and? What do you
hope it will do? Use your copy of the .pdf reader, the one you think you
the client has? Some version in cyberspace? It had better fail just to
behave normally :-)

It not only can't if it ever could it shouldn't... :-)

I'm still trying to figure out why Herfried thought that some other TCP/IP
library would make a difference. It's not a bad idea, I'm just wondering
how people's minds work. These are computers... why not suppose that cars
know where we want to go and have them simply drive us there?
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
Hi Tom,

Frankly, I love your idea - but the streamreader (or component) would have
to be pretty smart to do what you suggest. But the more I think of it,

yes,
it should be able to! Great idea.

Bernie

"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:e%****************@TK2MSFTNGP12.phx.gbl...
Perhaps I misunderstood...

Is there a replacement for StreamReader in the Indy library which analyzes the file it is reading and decides which files to imbed? It could be I have
it entirely wrong but it seems... well let me use the term "unlikely."

If it has such a feature would you let us know?

Again... I'm probably phrasing things wrong. What makes you think
that
Indy
might be able to produce alternative results... that might be what I'm
trying to ask.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c1*************@ID-208219.news.uni-berlin.de...
> * "Tom Leylan" <ge*@iamtiredofspam.com> scripsit:
> > From a practical standpoint doesn't this look like streamreader is

the > > cause?
>
> Yes and no. The HTML file doesn't include the graphics files, it

only > references them.
>
> > I could be out to lunch but it would have to "read the stream" and
notice
> > there was a reference to a supported graphic type and decide to load that
> > too despite it being in a "different" stream (does it open it
read-only?)
> > and then it encounters what looks like a reference to a 20 minute

video
file
> > and so it reads that too. :-)
> >
> > I'm not certain I want streamreader to be that clever,
>
> 'StreamReader' isn't that clever, but you can provide a class
> 'TomsToolbox.HtmlStreamReader' or something similar :-).
>
> --
> Herfried K. Wagner [MVP]
> <http://dotnet.mvps.org/>
> Website Address Changed!



Nov 20 '05 #13
Hi Cor,

No; I haven't tested with frames; interesting idea, because that would
require at least the frameset page and the regular page.

Bernie

"Cor" <no*@non.com> wrote in message
news:uv**************@TK2MSFTNGP12.phx.gbl...
Hi Bernie,
The following code works fine:
Dim sr As StreamReader = New StreamReader("c:\htdogpro\bhome.htm")


Did you test this also with webpages with frames?

Just curious if this works, I am asuming that this does not work also?

Cor

Nov 20 '05 #14
Bernie... I appreciate the vote of confidence :-)

Parsing isn't as easy as you make out but you're asking StreamReader to do
it. It might make it troublesome to read a stream that happens to contain
what could be interpreted as a reference to a graphics image. Generally
speaking you would want it to recognize every format that could conceivably
be represented on an HTML page... I'll quote from the W3C site:
http://www.w3.org/Graphics/

"There is no limit in the Web specifications to the graphical formats that
can be used on the Web. You just need a MIME type so that the format is
labelled correctly for transfer across the Web, and so that a suitable
viewer (if one exists) can be located at the other end."

I'm not against somebody offering a library to do such a thing but I would
be a little concerned about a basic StreamReader class trying to handle it
all. Remember it isn't just about images. I'd have to locate a video and
audio formats page but I'm sure you get the point :-)

"Bernie Yaeger" <be*****@cherwellinc.com> wrote...
Why so difficult? Parsing a string isn't all that hard. How many key
strings need the component parse - .pdf, .gif, .png, .jpg - then, too,
<http, <href and various other tags, all of which is done now by the html
spec.

No, you're not giving yourself enough credit :-)

Bernie

Nov 20 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text...
5
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it...
2
by: Paul Turley | last post by:
Does anyone have some sample code for sending an HTML formatted message using CDONTS? Thanks RE: Sending HTML formatted mail using CDONTS -- Paul Turley, MCSD, MCAD, MCT, MSF...
3
by: VB Programmer | last post by:
My company has it's own webserver, which is going to host our ASP.NET web application. We want the website to be able to send out emails. 1. What do I need on the server so that it has the...
7
by: tshad | last post by:
I have been sending messages to myself from work that worked before and now all of my message only seem to be sending part of my messages. I get the first part of the message and then get...
4
by: Zeeway | last post by:
hi,every one! I have a question about sending emails.My codes works well over some smtp servers,but doesn't over the others. My codes is listed belowed: try { MailMessage mailObj = new...
1
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the...
4
by: cybervigilante | last post by:
I sent HTML formatted email, using PHP, to my Yahoo address from my server, and it came out fine, styles and all. I sent it to my gmail address to test it and all I see is the raw html code. But I...
8
by: wengkit | last post by:
i'm using System.Web.Mail in my application and i set the BodyFormat = MailFormat.Html; in MS C#.net MailMessage mailMsg = new MailMessage(); mailMsg.To = txtTo.Text; mailMsg.Cc =txtCc.Text;...
3
by: CJM | last post by:
David, Thanks for the reply. Responses inline: "David E. Ross" <nobody@nowhere.notwrote in message news:OZadnaBdOMGpYb3VnZ2dnUVZ_vOdnZ2d@softcom.net... This is a promotional mailshot so...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.