Showing posts with label e-mail. Show all posts
Showing posts with label e-mail. Show all posts

Monday, March 26, 2012

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"JoeP" <DF_XYZ@.hotmail.com> wrote in message
news:ug8bTf5XHHA.4220@.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;
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
"JoeP" <DF_XYZ@.hotmail.com> wrote in message
news:OjyJY8$XHHA.992@.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
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
Hi,
Actually solution was simple just add font tag in html
like
oMailMessage.Body = "Hi <font face=verdana size=10>" & txtFirstName.Text & "
" & txtLastName.Text & ""
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
"Chetan Chaphekar" <ChetanChaphekar@.discussions.microsoft.com> wrote in
message news:F8362751-1E99-4F82-B043-D3D44F0A120F@.microsoft.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...
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
"JoeP" <DF_XYZ@.hotmail.com> wrote in message
news:OCnYUOPYHHA.3268@.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...
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
>
>

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

"JoeP" <DF_XYZ@.hotmail.comwrote in message
news:ug8bTf5XHHA.4220@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

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;
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
"JoeP" <DF_XYZ@.hotmail.comwrote in message
news:OjyJY8$XHHA.992@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Thanks for your reply. But how do I keep the Verdana font of that embeded
string?


oMailMessage.IsBodyHtml = true;

Quote:

Originally Posted by

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

Quote:

Originally Posted by

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


"Chetan Chaphekar" <ChetanChaphekar@.discussions.microsoft.comwrote in
message news:F8362751-1E99-4F82-B043-D3D44F0A120F@.microsoft.com...

Quote:

Originally Posted by

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...
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
"JoeP" <DF_XYZ@.hotmail.comwrote in message
news:OCnYUOPYHHA.3268@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

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

Quote:

Originally Posted by

Otherwise the user will need to copy the URL into the Browser.


That's true.

Quote:

Originally Posted by

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

Quote:

Originally Posted by

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


"Chetan Chaphekar" <ChetanChaphekar@.discussions.microsoft.comwrote in
message news:85AB981F-934B-453F-A698-D79B7C5CF3B9@.microsoft.com...

Quote:

Originally Posted by

but also consider the percentage of receipient who has this kind of
settings.


Increasing all the time...

Quote:

Originally Posted by

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

pass through value of DropDownList ListItem into a string

Greetings.

I'm building an email form that uses a DropDownList to select the e-mail address via alias. Here is a portion of the control:

<asp:DropDownList id="ddlRecipient" CssClass="text-blue" AutoPostBack="true" runat="server">
<asp:ListItem Value="none" Selected="true">Please select from this list.</asp:ListItem>
<asp:ListItem Value="mornings">the morning show</asp:ListItem>
<asp:ListItem Value="news">News - newscasts, stories, comments</asp:ListItem>
</asp:DropDownList
Here is the code I am supposedly using to pass through the value:

Sub SendMe ()
Dim ddlRecipient As String
Dim ddlRecipientEmail As String = ddlRecipient & "@dotnet.itags.org.mydomain.com"
Response.Write(ddlRecipientEmail & " -- this is the email address you just sent")
End Sub

(The Response.Write line will be replaced by my email generation code, and I will use ddlRecipientEmail as the "from" field.)

However, all I get from the Response.Write is:
@dotnet.itags.org.mydomain.com -- this is the email address you just sent

So it's not passing through the value. How do I get it to do that?

Also, I'm going to do an If/Then/Else statement that, if "none" is the value, you get a popup and the program stops running. Anyone got a quick way to do that?

Appreciate the help.

ddlRecipient.SELECTEDVALUE


Curt_C:

ddlRecipient.SELECTEDVALUE

I actually just found that and it is working now.Thank you.