Question sending a link in an email

oldpl1guy

Member
Joined
Jun 27, 2009
Messages
13
Programming Experience
1-3
Greetings,

I am developing an app that requires users to register to use. I request an email address to which I send a clickable link that allows the user to then register a userID and a password. All works well EXCEPT...when the link appears in the recipient's mail it also contains information that is being embedded by the system. I am sending http://www.(web site).com/blog/Validate/default.aspx?passvalue=(recipient email address).
What is being received is:
(recipient email address)" class="parsedLink" target="_blank">http://www.(web site)/blog/Validate/default.aspx?passvalue=(recipient email address).

Is there any way to strip off the information in front of http:...?

The link is not clickable as it is received.

Thanks
Tom
 

Joshdbr

Well-known member
Joined
Apr 7, 2011
Messages
211
Location
Montana, USA
Programming Experience
5-10
Could you post some code examples of what you are using to embed the link?

Thanks
-Josh
 

oldpl1guy

Member
Joined
Jun 27, 2009
Messages
13
Programming Experience
1-3
Hi Josh,

Thanks for the interest. The code is below.

Where: (passemailidlb.Text) is the email address provided by the user
(fromemailaddress) is the email address of my website
(userid) and (password) are my network userid and password
(website) is my website name
(cr) is vbNewLine
(achar) is a string variable

Sub sendemail()
Try
Dim mailSMTPClient As New SmtpClient("outgoing.verizon.net")
Dim mailFromAddress As New MailAddress(fromemailaddress)
Dim mailToAddress As New MailAddress(passemailidlb.Text)
Dim mailMessage As New MailMessage(mailFromAddress, mailToAddress)
mailSMTPClient.Credentials = New NetworkCredential((userid),(password))
With mailMessage
.Subject = "email verification from UnoBlog"
achar = "Click on the link below to verifiy your email. " & (cr)
achar = (achar) & "http://www.(website).com/blog/Validate/default.aspx?passvalue=" & (passemailidlb.Text)
.Body = (achar)
End With
With mailSMTPClient
.DeliveryMethod = SmtpDeliveryMethod.Network
.Send(mailMessage)
End With
Catch ex As Exception
okflag = "N"
MsgBox("Exception: " & ex.Message)
End Try
End Sub

Any insight would be appreciated.
Tom
 

Joshdbr

Well-known member
Joined
Apr 7, 2011
Messages
211
Location
Montana, USA
Programming Experience
5-10
When I use this code:

Sub sendemail()
        Try
            Dim achar As String = ""
            Dim cr As String = vbNewLine
            Dim mailSMTPClient As New SmtpClient(smtpserver)
            Dim mailFromAddress As New MailAddress(fromemailaddress)
            Dim mailToAddress As New MailAddress(toemailaddress)
            Dim mailMessage As New MailMessage(mailFromAddress, mailToAddress)
            'mailSMTPClient.Credentials = New NetworkCredential((userid), (password))
            With mailMessage
                .Subject = "test"
                achar = "Click on the link below to verifiy your email. " & (cr)
                achar = (achar) & "http://www.(website).com/blog/Validate/default.aspx?passvalue=" & ("user@domain.com")
                .Body = (achar)
            End With
            With mailSMTPClient
                .DeliveryMethod = SmtpDeliveryMethod.Network
                .Send(mailMessage)
            End With
        Catch ex As Exception
            MsgBox("Exception: " & ex.Message)
        End Try
    End Sub


This is what I get:


The link was clickable. It could be your email program, is it possible for you to try a different one (or a different computer)? It could also be Verizon's network, so you might try a different SMTP server/email address.


-Josh
 

Joshdbr

Well-known member
Joined
Apr 7, 2011
Messages
211
Location
Montana, USA
Programming Experience
5-10
I just this code on Gmail's server and got the same result.

 Sub sendemail()
        Try
            Dim achar As String = ""
            Dim cr As String = vbNewLine
            Dim mailSMTPClient As New SmtpClient("smtp.gmail.com")
            Dim mailFromAddress As New MailAddress("user@gmail.com")
            Dim mailToAddress As New MailAddress("user@domain.com")
            Dim mailMessage As New MailMessage(mailFromAddress, mailToAddress)
            mailSMTPClient.Credentials = New NetworkCredential(("user@gmail.com"), ("password"))
            With mailMessage
                .Subject = "email verification from UnoBlog"
                achar = "Click on the link below to verifiy your email. " & (cr)
                achar = (achar) & "http://www.(website).com/blog/Validate/default.aspx?passvalue=" & (mailFromAddress.Address)
                .Body = (achar)
            End With
            With mailSMTPClient
                .DeliveryMethod = SmtpDeliveryMethod.Network
                .EnableSsl = True
                .Port = 587
                .Send(mailMessage)
            End With
        Catch ex As Exception
            MsgBox("Exception: " & ex.Message)
        End Try
    End Sub
 

oldpl1guy

Member
Joined
Jun 27, 2009
Messages
13
Programming Experience
1-3
Hi Josh,

Many thanks for the suggestions. I had been using a 64 bit Vista machine so I tried an XP system, with the same error result.

I'll try it on a different email and see what happens.

Thanks again,
Tom
 

Joshdbr

Well-known member
Joined
Apr 7, 2011
Messages
211
Location
Montana, USA
Programming Experience
5-10
OK, I'm on Win 7 x86 and was using VS 2008 Pro and Mozilla Thunderbird 3.1 if that helps.
 

oldpl1guy

Member
Joined
Jun 27, 2009
Messages
13
Programming Experience
1-3
Josh,

I just tried sending using gmail with the same error result.

The app is created with Microsoft Visual Web Developer 2008 Express Edition, on a Vista 64 bit system with Internet Explorer 9. I've also tried in with Explorer 8. I'm running on a local area network (1 Vista desktop, 1 Vista laptop, 2 XP desktops) in my home using a NetGear router. My internet connection is FIOS. I guess I'll have to run through the possible options and see if it can be resolved.

Many thanks again,
Tom
 

Joshdbr

Well-known member
Joined
Apr 7, 2011
Messages
211
Location
Montana, USA
Programming Experience
5-10
OK, keep us posted. Sorry I couldn't be more help.
 

oldpl1guy

Member
Joined
Jun 27, 2009
Messages
13
Programming Experience
1-3
Hi Josh,

I just tried changing the recipient email from Verizon to gmail and the "(recipient email address)" class="parsedLink" target="_blank">" is not stuck on the front of "http://www.(web site)/blog/Validate/default.aspx?passvalue=(recipient email address)." I was able to click on the link successfully. That, of course, doesn't resolve the problem...but does point to something with my Verizon email account. The concern is that I have been able to receive clickable links in my Verizon account from a variety of other sources; and I certainly don't want Verizon email accounts to have to cut/paste to access the link I send. I'll keep at it and let you know if I come up with anything.

Thanks for all your help.
Tom
 

Joshdbr

Well-known member
Joined
Apr 7, 2011
Messages
211
Location
Montana, USA
Programming Experience
5-10
Odd, well keep us posted, if you find any solutions let us know.

Thanks
-Josh
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,609
Location
Norway
Programming Experience
10+

Joshdbr

Well-known member
Joined
Apr 7, 2011
Messages
211
Location
Montana, USA
Programming Experience
5-10
That might make a difference :). I noticed that, but for some reason overlooked it...
 

oldpl1guy

Member
Joined
Jun 27, 2009
Messages
13
Programming Experience
1-3
Hi JohnH and Josh,

I included under with mailMessage .IsBodyHtml = True, but it does not resolve the issue. I could provide a line in the body of the message stating that if the link does not begin with http: cut from http: to the end of the link and paste it in the browser, but that is very clumsy. I'll keep checking for a resolution and let you know if I find one.

Many thanks for your thoughts,
Tom
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,609
Location
Norway
Programming Experience
10+
I included under with mailMessage .IsBodyHtml = True
And then you code Html body. To create a link (anchor tag): HTML a tag
 
Top Bottom