Sending data with a generated email

J

JJ297

Hello,

After a user enters their request I'm sending a generated email to
someone. How do I get that question to appear in the email? I have
the link appearing in the email. This is what I have thus far.

Dim ocdoEmail As New Object
ocdoEmail = Server.CreateObject("CDO.Message")
ocdoEmail.To = Session("GetEmail")
ocdoEmail.From = Session("GetEmail")
ocdoEmail.Subject = "EDCS Question"
ocdoEmail.HTMLBody = "<a href=""http://seb2a54/cdpedcsfaqs/
validate.aspx?quesid=" & x & """> Click to view question that was
submitted.</a>"
Response.Write("@questions")
'sending the question ID over but going through the validate
page first
ocdoEmail.send()

I put in a Response.Write("@questions") which is the field in the
database but only the link appears. Any suggestions?

Thanks
 
R

RB

JJ297 said:
Hello,

After a user enters their request I'm sending a generated email to
someone. How do I get that question to appear in the email? I have
the link appearing in the email. This is what I have thus far.

Dim ocdoEmail As New Object
ocdoEmail = Server.CreateObject("CDO.Message")
ocdoEmail.To = Session("GetEmail")
ocdoEmail.From = Session("GetEmail")
ocdoEmail.Subject = "EDCS Question"
ocdoEmail.HTMLBody = "<a href=""http://seb2a54/cdpedcsfaqs/
validate.aspx?quesid=" & x & """> Click to view question that was
submitted.</a>"
Response.Write("@questions")
'sending the question ID over but going through the validate
page first
ocdoEmail.send()

I put in a Response.Write("@questions") which is the field in the
database but only the link appears. Any suggestions?

Thanks

Hi JJ,

The reason this does not work is because the CDO message object is
basically nothing to do with ASP (except insofar as it relies on IIS to
route the emails it sends). So when you Response.Write you're writing
into the Response stream, which is totally unrelated to CDO.

What you should really be doing is something like this:

Dim myMessage as String
myMessage="<a href=etcetcetc>Click Here </a>"
myMessage += myQuestionsVariable
ocdoEmail.send()

Where myQuestionsVariable is a variable in which you have read the
contents of "@questions" - I'm not really sure what "@questions" is, so
I can't really help with this bit I'm afraid.

Cheers,

RB.
 
J

JJ297

Hi JJ,

The reason this does not work is because the CDO message object is
basically nothing to do with ASP (except insofar as it relies on IIS to
route the emails it sends). So when you Response.Write you're writing
into the Response stream, which is totally unrelated to CDO.

What you should really be doing is something like this:

Dim myMessage as String
myMessage="<a href=etcetcetc>Click Here </a>"
myMessage += myQuestionsVariable
ocdoEmail.send()

Where myQuestionsVariable is a variable in which you have read the
contents of "@questions" - I'm not really sure what "@questions" is, so
I can't really help with this bit I'm afraid.

Cheers,

RB.- Hide quoted text -

- Show quoted text -

Thanks RB actually I got it to work I just added this to the end of
my HTML Body

ocdoEmail.HTMLBody = "<a href=""http://seb2a54/cdpedcsfaqs/
validate.aspx?quesid=" & x & """> Click to view question that was
submitted.</a> <br /> <br />" & Txtquestion.Text

Txtquestion.Text is the name of my field on the page. Sorry if I was
confusing.
 
R

RB

Thanks RB actually I got it to work I just added this to the end of
my HTML Body

ocdoEmail.HTMLBody = "<a href=""http://seb2a54/cdpedcsfaqs/
validate.aspx?quesid=" & x & """> Click to view question that was
submitted.</a> <br /> <br />" & Txtquestion.Text

Txtquestion.Text is the name of my field on the page. Sorry if I was
confusing.

Sorry - I just noticed a mistake in my code as well - I never actually
set the emails body text!!!

Glad you got it working :)

RB.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top