Sending an email with hyperlink

Discussion in 'ASP .Net' started by JJ297, Aug 10, 2007.

  1. JJ297

    JJ297 Guest

    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.
     
    JJ297, Aug 10, 2007
    #1
    1. Advertising

  2. JJ297

    Mike Guest

    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



    "JJ297" <> wrote in message
    news:...
    > 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.
    >
     
    Mike, Aug 10, 2007
    #2
    1. Advertising

  3. 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")
    >
    > ocdoEmail.send()
    >
    > Thanks.
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Aug 10, 2007
    #3
  4. JJ297

    Mike Guest

    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]" <> wrote
    in message news:...
    > 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")
    >>
    >> ocdoEmail.send()
    >>
    >> Thanks.
    >>
    >>
     
    Mike, Aug 10, 2007
    #4
  5. JJ297

    JJ297 Guest

    On Aug 10, 11:39 am, "Mike" <> wrote:
    > 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]" <> wrote
    > in messagenews:...
    >
    >
    >
    > > 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")

    >
    > >> 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>
     
    JJ297, Aug 10, 2007
    #5
  6. JJ297

    Mike Guest

    do you have the email body set to HTML?
    "JJ297" <> wrote in message
    news:...
    > On Aug 10, 11:39 am, "Mike" <> wrote:
    >> 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]" <>
    >> wrote
    >> in messagenews:...
    >>
    >>
    >>
    >> > 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")

    >>
    >> >> 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>
    >
     
    Mike, Aug 10, 2007
    #6
  7. JJ297

    JJ297 Guest

    On Aug 10, 3:10 pm, "Mike" <> wrote:
    > do you have the email body set to HTML?"JJ297" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > On Aug 10, 11:39 am, "Mike" <> wrote:
    > >> 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]" <>
    > >> wrote
    > >> in messagenews:...

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

    >
    > >> >> 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 = ""
    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?
     
    JJ297, Aug 13, 2007
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. davetichenor
    Replies:
    1
    Views:
    845
    Eliyahu Goldin
    Oct 30, 2006
  2. Luke
    Replies:
    2
    Views:
    4,730
    Nigel Wade
    Mar 15, 2007
  3. rote
    Replies:
    8
    Views:
    777
  4. Ken
    Replies:
    1
    Views:
    387
    Alvin Bruney
    Aug 16, 2003
  5. Dave
    Replies:
    0
    Views:
    958
Loading...

Share This Page