Sending an email with hyperlink

  • Thread starter Thread starter JJ297
  • Start date Start date
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.
 
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
 
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
 
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>
 
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>
 
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?
 
Back
Top