Click here to Skip to main content
15,891,910 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

In my project i need to send confirmation link to user in a mail.Now, problem is that when user receives mail, the link is divided in two lines from which first line act as a hyperlink but the second line behaves as a simple text and it does not navigate user to right page.
Please help me!

Thanks!
Posted
Comments
m@dhu 28-Mar-11 1:24am    
Are you using a html template? Probably a </br> is coming in between the two lines. Show your code.
zan0701 28-Mar-11 2:52am    
No, It's not alike. I checked it and even removed all whitespace,too.
m@dhu 28-Mar-11 4:13am    
If you could show the code it would be easy for us to help.
zan0701 28-Mar-11 4:37am    
I have used .resx file and the link where i have declared a variable which is having an anchor tag in value :
href="{2}ConfirmEmail.aspx?ID={0}&Code={1}"
where i pass the values for {0},{1} and {2}.
I use this variable in email body.
m@dhu 28-Mar-11 4:58am    
Check my answer.

It seems issue with URL query string. So use URL encoding when you are placing in email.

http://msdn.microsoft.com/en-us/library/zttxte6w.aspx[^]
 
Share this answer
 
Comments
zan0701 28-Mar-11 4:28am    
Thanks Parwej. But it's not the solution of my problem. Because, Link is working when it is in single line but when half of link goes in second line then it cause problem.
Parwej Ahamad 28-Mar-11 4:31am    
Post here your C# Code and Email Text
zan0701 28-Mar-11 4:51am    
I have used .resx file and the link where i have declared a variable which is having an anchor tag in value :
href="{2}ConfirmEmail.aspx?ID={0}&Code={1}"
where i pass the values for {0},{1} and {2}.
I use this variable in email body.
Use a string for the url and then concatenate with other content. Check below..
string strBody="";
string EMAIL="test@test.test";
string myURL = "http://www.testweb.com/testpage.aspx?eml=" + EMAIL.ToString();
strBody = strBody + "Date: <strong>" + DateTime.Now.ToShortDateString()+ "</strong><br><br>";
strBody = strBody + "<a href=" + myURL + " targer= _blank>click here</a>";
 
Share this answer
 
Comments
zan0701 28-Mar-11 5:30am    
Thanks but it is not the solution. the content of mail is :

Please click on this link to confirm you new email:
Click Here
http://www.myproject.com/ConfirmEmail.aspx?ID=01f9c53bbba04fb2aca2a66f0
4724040 &Code=632201720


As you can see in some email the link is very long and the hyperlink often does not encompass the entire link.
m@dhu 28-Mar-11 5:48am    
Just show click here instead of complete link.
Your link should show only click here without the complete link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900