I send some message to email as below:
string link = "http://localhost:1900/ResetPassword/?username=" + user.UserName + "&reset=" + HashResetParams( user.UserName, user.ProviderUserKey.ToString() );
email.Body = link;
This string was sent to email, but shown as string, not as link, I want send it as link to click.
Try this
string link = String.Format("<a href=\"http://localhost:1900/ResetPassword/?username={0}&reset={1}\">Click here</a>", user.UserName, HashResetParams( user.UserName, user.ProviderUserKey.ToString() ));
Wrap link
in an anchor tag:
string link = '<a href="http://......">Click here to reset your password</a>';
and
email.IsBodyHtml = true;
Or combine them together using string concatenation and feed into email.Body
. An email body is HTML, so it wont be a link unless you tell it to be one. Also, don't forget to tell it that the body is HTML, like I always do.
Make it a link with the a
HTML tag. And don't forget to set the MailMessage
as HTML body:
string link = "http://localhost:1900/ResetPassword/?username=" + user.UserName + "&reset=" + HashResetParams( user.UserName, user.ProviderUserKey.ToString() );
email.Body = "<a href='" + link + "'>" + link + "</a>";
email.IsBodyHtml = true;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With