473,385 Members | 1,392 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,385 software developers and data experts.

Sending Email with HTML body

Vi
Hi,
Is there a simple way to send an email from ASP.NET using the MailMessage
class with MyMessage.BodyFormat = MailFormat.Html, such that the body of the
email will come from an existing HTML file?

All the examples I was able to find have something like this:
string strBody = "<html><body><b>Hello World</b>" +
" <font color=\"red\">ASP.NET</font></body></html>";
MyMessage.Body = strBody;

But I want the content to come directly from an existing HTML file.
Thanks in advance.

Jan 18 '06 #1
1 1147
If this is a pure .html file, you can simply open it via the StreamReader.

dim sr as StreamReader
try
sr = new StreamReader("myFile.html")
dim content as string = sr.ReadToEnd()
MyMessage.Body = content
finally
if not sr is nothing then
sr.close()
end if
end try

--
http://www.openmymind.net/

"Vi" <Vi@discussions.microsoft.com> wrote in message
news:A7**********************************@microsof t.com...
Hi,
Is there a simple way to send an email from ASP.NET using the MailMessage
class with MyMessage.BodyFormat = MailFormat.Html, such that the body of
the
email will come from an existing HTML file?

All the examples I was able to find have something like this:
string strBody = "<html><body><b>Hello World</b>" +
" <font color=\"red\">ASP.NET</font></body></html>";
MyMessage.Body = strBody;

But I want the content to come directly from an existing HTML file.
Thanks in advance.

Jan 18 '06 #2

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...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
4
by: Roger Withnell | last post by:
I'm sending Russian text in an email generated from the website which displays in the email as ?????????? The website is set to codepage 65001 and the charset to utf-8. Please advise. ...
7
by: Ray Booysen | last post by:
Hi all I'm sending email via ASP.NET in HTML mode. Each email has exactly one attachment and I do have full access to the SMTP server. However, if I send the email in HTML format, the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.