Hyperlink in SMTPMail

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I am trying to build an aspx page that will send customized emails to a list
of email addresses (in a SQL Server table) where each email has a customized
hyperlink. As part of the body of the outgoing message I want a section that
is something like:

=========================================
Click on the following link to verify your email address:
http://mysite.com/mypage.aspx?i=nnn
=========================================

where "nnn" is an integer pulled from the database for that row.

How can I accomplish this?

Wayne
 
I found information on the URI object and tried that but the URL in the
resulting email is not showing up as a link? I see the correct URL but it is
not "clickable"?

Wayne
 
Step1 : Add a reference to System.Web.Mail

Step2 : Add the Imports System.Web.Mail Statements

Step 3: Use something like my code here, DONT FORGET TO CHANGE THE -
SMTPMAILSERVER Name, see below



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim mm As New MailMessage

Dim body As New TextBox

body.Multiline = True

body.AppendText("=============================<BR>")

body.AppendText("<a href=http://TrainingOn.net>TrainingOn.net For all your
Developer Training</a><BR>")

body.AppendText("=============================<BR>")

mm.To = (e-mail address removed)

mm.From = "(e-mail address removed)"

mm.Subject = "Test Message"

mm.BodyFormat = MailFormat.Html

mm.Body = body.Text

SmtpMail.SmtpServer = "YOURSMTPMAILSERVERNAME"

Try

SmtpMail.Send(mm)

Catch ex As System.Web.HttpException

MsgBox(ex.InnerException.ToString)

End Try

End Sub
 
Thanks.

Wayne

Mad Murdoch said:
Step1 : Add a reference to System.Web.Mail

Step2 : Add the Imports System.Web.Mail Statements

Step 3: Use something like my code here, DONT FORGET TO CHANGE THE -
SMTPMAILSERVER Name, see below



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim mm As New MailMessage

Dim body As New TextBox

body.Multiline = True

body.AppendText("=============================<BR>")

body.AppendText("<a href=http://TrainingOn.net>TrainingOn.net For all your
Developer Training</a><BR>")

body.AppendText("=============================<BR>")

mm.To = (e-mail address removed)

mm.From = "(e-mail address removed)"

mm.Subject = "Test Message"

mm.BodyFormat = MailFormat.Html

mm.Body = body.Text

SmtpMail.SmtpServer = "YOURSMTPMAILSERVERNAME"

Try

SmtpMail.Send(mm)

Catch ex As System.Web.HttpException

MsgBox(ex.InnerException.ToString)

End Try

End Sub
 
Mad said:
Step1 : Add a reference to System.Web.Mail

Step2 : Add the Imports System.Web.Mail Statements

Step 3: Use something like my code here, DONT FORGET TO CHANGE THE -
SMTPMAILSERVER Name, see below



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim mm As New MailMessage

Dim body As New TextBox

body.Multiline = True

body.AppendText("=============================<BR>")

body.AppendText("<a href=http://TrainingOn.net>TrainingOn.net For all your
Developer Training</a><BR>")

body.AppendText("=============================<BR>")

mm.To = (e-mail address removed)

mm.From = "(e-mail address removed)"

mm.Subject = "Test Message"

mm.BodyFormat = MailFormat.Html

mm.Body = body.Text

SmtpMail.SmtpServer = "YOURSMTPMAILSERVERNAME"

Try

SmtpMail.Send(mm)

Catch ex As System.Web.HttpException

MsgBox(ex.InnerException.ToString)

End Try

End Sub
You missed out Step 4:

Think about the sanity, in this day and age, of encouraging people to
click on links sent out in emails. This may not (in fact, reading the
initial blurb, almost certainly isn't) an internet banking system, but
it's still a principle worth sticking with.

Once the ONLY people sending clickable links in emails for account
information are the phishers, maybe people will stop clicking on them.
 
Back
Top