如何使用vb.net将超链接放入电子邮件正文中

Wil*_*ill 3 vb.net

我想要做的是在vb.net中添加一个超链接到电子邮件正文.我发送电子邮件时得到的是链接是文本.这是我到目前为止所做的事情.任何帮助将非常感谢.

    'Accepts two parameters - the username and password for the email client
    Dim credentials As New System.Net.NetworkCredential("test@test.net", "test")

    smtpClient.Credentials = credentials
    Dim body, link As String

    link = "http://localhost:" & partUrl & "/test.aspx?autoNum=" & autoNum
    body = "Test email." & "<br/><br/>"

    body += link

    Dim email As New MailMessage
    email.From = New MailAddress("test@test.net")
    email.Body = body
    email.Subject = "test Change/Request Password"
    email.To.Add(New MailAddress(toAddress))

    smtpClient.Send(email)
Run Code Online (Sandbox Code Playgroud)

chr*_*ie1 6

您需要将其包含在标签中.

link = "<a href=""http://localhost:" & partUrl & "/test.aspx?autoNum=" & autoNum & """>Click here</a>"
Run Code Online (Sandbox Code Playgroud)

你需要设置

email.IsBodyHtml = true
Run Code Online (Sandbox Code Playgroud)