473,385 Members | 1,356 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.

Pass the name into HTM file

Hi All,



I have an HTML which I load as string and send it via MailMessage class.
oMailMessage.Body = cHTMLString



Before it is sent as e-mail I need to pass the HTM file the user

First and Last in the first line.



It is a form where the user enters his/her details and then it is

e-mailed the user with the HTM file within the e-mail's body.



It would start like:



Hi Steve Smith,



How can I embed the First and Last name of the user into the htm file?



Thanks,



Joe






Mar 6 '07 #1
10 1356
"JoeP" <DF****@hotmail.comwrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
I have an HTML which I load as string and send it via MailMessage class.
oMailMessage.Body = cHTMLString

Before it is sent as e-mail I need to pass the HTM file the user
First and Last in the first line.

It is a form where the user enters his/her details and then it is
e-mailed the user with the HTM file within the e-mail's body.

It would start like:

Hi Steve Smith,

How can I embed the First and Last name of the user into the htm file?
oMailMessage.Body = "Hi " + txtFirstName.Text + " " + txtLastName.Text +
",\r\n\r\n";
oMailMessage.Body += cHTMLString;
Mar 6 '07 #2
Hi Mark,

Thanks for your reply. But how do I keep the Verdana font of that embeded
string?
Also the semi column was a problem and got an err which is: Character is not
valid

oMailMessage.Body = "Hi " + txtFirstName.Text + " " + txtLastName.Text +
",\r\n\r\n";
oMailMessage.Body += cHTMLString;

Thanks,

Joe
Mar 6 '07 #3
"JoeP" <DF****@hotmail.comwrote in message
news:Oj*************@TK2MSFTNGP04.phx.gbl...
Thanks for your reply. But how do I keep the Verdana font of that embeded
string?
oMailMessage.IsBodyHtml = true;
Also the semi column was a problem and got an err which is: Character is
not valid
Ah - I assumed you were using C#...

If you're using VB.NET, you'll (probably) need to do something like:

oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
vbCrLf & vbCrLf
oMailMessage.Body = oMailMessage.Body & cHTMLString

oMailMessage.IsBodyHtml = True
Mar 6 '07 #4
Hi Mark,

Your idea works as well, but even though: oMailMessage.IsBodyHtml = True
The fornt of the below is not the same any more:

oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
vbCrLf & vbCrLf

What I did is: In the first line of the HTM file I did as follows:
Hi {First Name} {Last Name},

Then:
cHTMLString = cHTMLString.Replace("{First Name}", txtFName.Text)

cHTMLString = cHTMLString.Replace("{Last Name}", txtLName.Text)

Thanks,

Joe
Mar 6 '07 #5
Hi,
Actually solution was simple just add font tag in html
like

oMailMessage.Body = "Hi <font face=verdana size=10>" & txtFirstName.Text & "
" & txtLastName.Text & "</font>"
vbCrLf & vbCrLf
oMailMessage.Body = oMailMessage.Body & cHTMLString

oMailMessage.IsBodyHtml = True

it will definately work

cheers
Chetan Chaphekar

"JoeP" wrote:
Hi Mark,

Your idea works as well, but even though: oMailMessage.IsBodyHtml = True
The fornt of the below is not the same any more:

oMailMessage.Body = "Hi " & txtFirstName.Text & " " & txtLastName.Text &
vbCrLf & vbCrLf

What I did is: In the first line of the HTM file I did as follows:
Hi {First Name} {Last Name},

Then:
cHTMLString = cHTMLString.Replace("{First Name}", txtFName.Text)

cHTMLString = cHTMLString.Replace("{Last Name}", txtLName.Text)

Thanks,

Joe
Mar 7 '07 #6
"Chetan Chaphekar" <Ch*************@discussions.microsoft.comwrote in
message news:F8**********************************@microsof t.com...
it will definately work
As far as you are concerned, it will definitely work...

However, you need to think quite carefully about sending HTML emails...

Most modern mail software can be configured not only to strip out all HTML
content, but also to reject emails with HTML content...

Depending on how paranoid / security-conscious your recipients are, they
might never even see your emails if you send them in HTML format...
Mar 7 '07 #7
Hi Mark,

The problem is that I have some links in that HTM file. So I how can I
provide those links without any HTM code. Otherwise the user will need to
copy the URL into the Browser. Not that productive.

Regards,

Joe
Mar 7 '07 #8
"JoeP" <DF****@hotmail.comwrote in message
news:OC**************@TK2MSFTNGP04.phx.gbl...
The problem is that I have some links in that HTM file. So I how can I
provide those links without any HTM code.
You can't...
Otherwise the user will need to copy the URL into the Browser.
That's true.
Not that productive.
Even less productive if the email gets rejected by the user's mail client
before the user even has a chance to see it...

Your call...
Mar 7 '07 #9
Hi Joep,

What mark has said is right but also consider the percentage of receipient
who has this kind of settings. almost all sites who send newsletter to the
subscriber use HTML code in their email.

cheers
chetan chaphekar

"JoeP" wrote:
Hi Mark,

The problem is that I have some links in that HTM file. So I how can I
provide those links without any HTM code. Otherwise the user will need to
copy the URL into the Browser. Not that productive.

Regards,

Joe
Mar 8 '07 #10
"Chetan Chaphekar" <Ch*************@discussions.microsoft.comwrote in
message news:85**********************************@microsof t.com...
but also consider the percentage of receipient who has this kind of
settings.
Increasing all the time...
almost all sites who send newsletter to the subscriber use HTML code in
their email.
More and more now give their recipients the option of receiving such
correspondence either in plain text or HTML...
Mar 8 '07 #11

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

Similar topics

23
by: John | last post by:
Last year, I remember finding a web page describing how to pass the name of a file to another web page, and have that web page load that image file. Now, I can't find my record of that (it was...
1
by: Jonathan Gibbs | last post by:
I'm very new to xml, and struggling a bit.. I want to use an .xsd file passed to a windows application to define a dataset's schema, and also (if possible) pass other metadata associated with...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
5
by: Fresh Air Rider | last post by:
Hello Could anyone please explain how I can pass more than one arguement/parameter value to a function using <asp:linkbutton> or is this a major shortfall of the language ? Consider the...
1
by: jacobyv | last post by:
hi i created survey.asp which displays the survey passed through the name paramter in the url. it works fine if i open the page like this. http://url/survey.asp?name=survey1 but now i would...
28
by: Bill | last post by:
Hello All, I am trying to pass a struct to a function. How would that best be accomplished? Thanks, Bill
5
by: gdarian216 | last post by:
can I pass grades.projects in my function call that is void get_scores(ifstream& infile, int num_scores, grades.projects) and the function would look like void get_scores(ifstream& infile, int...
31
by: Sam of California | last post by:
Is it accurate to say that "the preprocessor is just a pass in the parsing of the source file"? I responded to that comment by saying that the preprocessor is not just a pass. It processes...
6
by: lisp9000 | last post by:
I've read that C allows two ways to pass information between functions: o Pass by Value o Pass by Reference I was talking to some C programmers and they told me there is no such thing as...
24
by: =?Utf-8?B?U3dhcHB5?= | last post by:
Can anyone suggest me to pass more parameters other than two parameter for events like the following? Event: Onbutton_click(object sender, EventArgs e)" Event handler: button.Click += new...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.