We help IT Professionals succeed at work.

mailto link using variables

savache27
savache27 asked
on
703 Views
Last Modified: 2008-02-01
Hi,

I'm trying to build a mailto link using variables, but I can't seem to string them together properly. I know the values are going into the variables because I'm doing a response.write to see the values. I had it working with the sendTo variable going into the To of the email, but the bcc wasn't working. Now I can't even get the sendTo variable to work. Can someone please look at my code and tell me what I am doing wrong?


Private Sub BuildEmailLink(ByVal sql As String)
        Dim vOrigSQL
        vOrigSQL = sql
        txtOrigSQL.Text = vOrigSQL
        Label1.Text = ""
        Dim Myconn As SqlConnection
        Dim Mycomm As SqlCommand
        Dim dtr As SqlDataReader
        Dim dadapter As SqlDataAdapter
        Dim result
        Dim vBcc, sendTo As String
        sendTo = Trim(Session("gUserName")) & "@nsula.edu" & "?"
        Dim Success As Boolean
        Myconn = New SqlConnection(ConfigurationSettings.AppSettings("gDataSource"))
        lblapp.Text = ""
        lblapp.Visible = True
        txtTrigger.Text = "O"
        Myconn.Open()
        Mycomm = New SqlCommand(sql, Myconn)
        Try
            dtr = Mycomm.ExecuteReader()
            If dtr.HasRows Then
                Success = True
                While dtr.Read
                    If Len(Trim(dtr("Email"))) < 2 Then
                    Else
                        vBcc = vBcc & Trim(dtr("Email")) & ";"
                    End If
                End While
                Dim vEmailLink
                vEmailLink = "<a href=""mailto:" & sendTo & ">Mail Link</a>"
                'vEmailLink = vBcc
                Label1.Visible = True
                Label1.Text = vEmailLink
            Else
                Success = False
                Myconn.Close()
                Label1.Visible = True
                Label1.Text = "An error occurred generating the email link"
            End If
        Catch ex As Exception
            Success = False
            'Response.Write(sql & "<br>")
            Response.Write(ex.Message & "<br>")
        End Try
        Response.Write(sendTo)
        'Response.Write(vBcc)
    End Sub

Open in new window

Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
okay, that works...but I need to string the  sendTo and the vBcc variables

Author

Commented:
Nevermind, I figured it out. Thanks so much for the help!!! I really do appreciate it!
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.