
October 7th, 2009, 11:43 PM
|
|
Registered User
|
|
Join Date: Oct 2009
Posts: 1
Time spent in forums: 16 m 52 sec
Reputation Power: 0
|
|
|
Dynamic hyperlink in an email using vb
Halo everyone,
I would like to show out a hyperlink in my email. The hyperlink I would like to add in variables from database. But, I am stuck in here.
Code:
Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
Dim emailFrom As String = "xxx@gmail.com"
Dim emailTo As String = txtUserEmail.Text
Dim emailSubject As String = "Email Confirmation"
Dim emailBody As String
Dim emailClient As New SmtpClient
emailBody = "================================================== =======================================" & vbCrLf
emailBody = emailBody & "=======THESE ARE THE COMMENTS FROM OUR DEARLY CUSTOMERS=======" & vbCrLf
emailBody = emailBody & "================================================== =======================================" & vbCrLf
emailBody = emailBody & "<a href='http://localhost:81/confirm/'>http://localhost:81/confirm/id=&</a>"
Try
Dim emailMessage As New MailMessage(emailFrom, emailTo, emailSubject, emailBody)
emailMessage.IsBodyHtml = True
emailMessage.Body = emailBody
emailMessage.Subject = emailSubject
emailClient.DeliveryMethod = SmtpDeliveryMethod.Network
emailClient.Send(emailMessage)
MsgBox("Email successfully sent.", MsgBoxStyle.Information, "Email Success")
Label1.Text = "Please check your email. Thank you."
SaveFeedback()
Exit Sub
Catch ex As Exception
MsgBox("Error in sending email. See System Administrator.", MsgBoxStyle.Critical, "Email Failure")
Exit Sub
End Try
End Sub
In my email, I would like to show something like these:
http://localhost:81/confirm/id=123456
Can anyone help me on this please.
Thanks.
Regards,
Justin
|