Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Pass the name into HTM file

Reply
Thread Tools

Pass the name into HTM file

 
 
JoeP
Guest
Posts: n/a
 
      03-06-2007
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








 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      03-06-2007
"JoeP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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;


 
Reply With Quote
 
 
 
 
JoeP
Guest
Posts: n/a
 
      03-06-2007
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


 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      03-06-2007
"JoeP" <(E-Mail Removed)> wrote in message
news:OjyJY8$(E-Mail Removed)...

> 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


 
Reply With Quote
 
JoeP
Guest
Posts: n/a
 
      03-06-2007
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
 
Reply With Quote
 
=?Utf-8?B?Q2hldGFuIENoYXBoZWthcg==?=
Guest
Posts: n/a
 
      03-07-2007
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

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      03-07-2007
"Chetan Chaphekar" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...

> 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...


 
Reply With Quote
 
JoeP
Guest
Posts: n/a
 
      03-07-2007
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


 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      03-07-2007
"JoeP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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...


 
Reply With Quote
 
=?Utf-8?B?Q2hldGFuIENoYXBoZWthcg==?=
Guest
Posts: n/a
 
      03-08-2007
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
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Type HTML into a textbox and automatically create .HTM files? =?Utf-8?B?TWlrZQ==?= ASP .Net 3 04-09-2007 10:00 AM
rename *-ch03.htm to ch03-*.htm? robertchen117@gmail.com Perl Misc 6 02-06-2007 08:59 AM
Is there a way to insert an existing htm page into body of a mailmessage? Mark Sandfox ASP .Net 2 06-24-2004 02:00 PM
Need to concatenate all files in a dir together into one file and read the first 225 characters from each file into another file. Tony Perl Misc 5 04-19-2004 03:28 PM
How to access a site to ony type the folde name (not .htm) Ole Svensen HTML 2 12-17-2003 03:26 PM



Advertisments