Sending an email with hyperlink

J

JJ297

Could someone please tell me what I'm doing wrong?

When I click on the submit button under button click I have the
following code to send a generated email. I want to capture the
QuesID from that page and place that in a hyperlink to the user so it
will take them to the edit page.


Dim ocdoEmail As New Object
ocdoEmail = Server.CreateObject("CDO.Message")
ocdoEmail.To = Session("GetEmail")
ocdoEmail.From = Session("GetEmail")
ocdoEmail.Subject = "EDCS Question"
ocdoEmail.textBody = "Here is the question that was submitted
CDPAdmin.aspx?quesID =" & Request.QueryString("QuesID")

ocdoEmail.send()

Thanks.
 
M

Mike

you can make your email body HTML. that will allow you to show the link.
and this:

ocdoEmail.textBody = "Here is the question that was submitted
CDPAdmin.aspx?quesID =" & Request.QueryString("QuesID")


should be something like
ocdoEmail.textBody = "<a href='cpadamin.aspx?quesID=&
Request.QueryString('QuesID')'>link here</a>";

i forget the actual syntax but something like that


Mike
 
M

Mike

He still has to have the to, from, subject, body, etc.
So if he uses CDO or System.Net.Mail namespace, he still needs that
information
 
J

JJ297

He still has to have the to, from, subject, body, etc.
So if he uses CDO or System.Net.Mail namespace, he still needs that
information

in message




- Show quoted text -

Thanks Mike I tried what you suggested but I'm getting this in the
email? What am I missing?

<a href='cpadamin.aspx?quesID=& Request.QueryString('QuesID')'>link
here</a>
 
M

Mike

do you have the email body set to HTML?
JJ297 said:
He still has to have the to, from, subject, body, etc.
So if he uses CDO or System.Net.Mail namespace, he still needs that
information

"Peter Bromberg [C# MVP]" <[email protected]>
wrote
in message

Why are you using legacy COM when you have the System.Net.Mail
namespace
which is managed code, to do this?
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"JJ297" wrote:
Could someone please tell me what I'm doing wrong?
When I click on the submit button under button click I have the
following code to send a generated email. I want to capture the
QuesID from that page and place that in a hyperlink to the user so it
will take them to the edit page.
Dim ocdoEmail As New Object
ocdoEmail = Server.CreateObject("CDO.Message")
ocdoEmail.To = Session("GetEmail")
ocdoEmail.From = Session("GetEmail")
ocdoEmail.Subject = "EDCS Question"
ocdoEmail.textBody = "Here is the question that was submitted
CDPAdmin.aspx?quesID =" & Request.QueryString("QuesID")

Thanks.- Hide quoted text -

- Show quoted text -

Thanks Mike I tried what you suggested but I'm getting this in the
email? What am I missing?

<a href='cpadamin.aspx?quesID=& Request.QueryString('QuesID')'>link
here</a>
 
J

JJ297

He still has to have the to, from, subject, body, etc.
So if he uses CDO or System.Net.Mail namespace, he still needs that
information
"Peter Bromberg [C# MVP]" <[email protected]>
wrote
in message
Why are you using legacy COM when you have the System.Net.Mail
namespace
which is managed code, to do this?
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
:
Could someone please tell me what I'm doing wrong?
When I click on the submit button under button click I have the
following code to send a generated email. I want to capture the
QuesID from that page and place that in a hyperlink to the user so it
will take them to the edit page.
Dim ocdoEmail As New Object
ocdoEmail = Server.CreateObject("CDO.Message")
ocdoEmail.To = Session("GetEmail")
ocdoEmail.From = Session("GetEmail")
ocdoEmail.Subject = "EDCS Question"
ocdoEmail.textBody = "Here is the question that was submitted
CDPAdmin.aspx?quesID =" & Request.QueryString("QuesID")
ocdoEmail.send()
Thanks.- Hide quoted text -
- Show quoted text -
Thanks Mike I tried what you suggested but I'm getting this in the
email? What am I missing?
<a href='cpadamin.aspx?quesID=& Request.QueryString('QuesID')'>link
here</a>- Hide quoted text -

- Show quoted text -

Thanks, I just set it to that and now it's okay but its still not
grabbing the QuesID

Here's my stored procedure:
REATE procedure AddQuestion

@quesdate datetime,
@topicid int,
@questions varchar(1000)

AS
Set NOCOUNT ON

INSERT INTO QuesNAns
(quesdate,topicid, questions)

values
(@quesdate,
@topicid,
@questions)

SET NOCOUNT OFF

SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY]
GO

Here's my code behind page:

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim question As String = Txtquestion.Text

Dim conn As New Data.SqlClient.SqlConnection("Data
Source=seb2a54;Initial Catalog=EDCSFAQS;Persist Security
Info=True;User ID=EDCSFAQUser;Password=fax")

Dim cmd As New Data.SqlClient.SqlCommand
With cmd
.Connection = conn 'the connection
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "AddQuestion"
.Parameters.AddWithValue("@topicid",
CInt(DropDownList1.SelectedItem.Value))
.Parameters.AddWithValue("@quesdate", QuesDate.Text)
.Parameters.AddWithValue("@questions", Txtquestion.Text)



End With

Try
conn.Open()
Dim x As Integer
x = cmd.ExecuteScalar
command.ExecuteNonQuery()

Catch ex As Data.SqlClient.SqlException
Throw New ApplicationException("An error occurred while
trying to insert the record")
Finally
conn.Close()
End Try

lbloutcome.Text = "Your entry was submitted into the
database."

Dim ocdoEmail As New Object
ocdoEmail = Server.CreateObject("CDO.Message")
ocdoEmail.To = Session("GetEmail")
ocdoEmail.From = Session("GetEmail")
ocdoEmail.CC = "(e-mail address removed)"
ocdoEmail.Subject = "EDCS Question"
ocdoEmail.HTMLBody = "<a href=""http://seb2a54/cdpedcsfaqs/
cdpadminEditpage.aspx?quesid=" & Request.QueryString("QuesID") & """>
Click to view question that was submitted.</a>"


ocdoEmail.send()

End Sub

Any suggestions?
 

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

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top