I have an email template (aspx
page) for password recovery.
I call it onSendingMail
like this:
StringWriter _writer = new StringWriter();
HttpContext.Current.Server.Execute("emailPasswordRecovery.aspx", _writer);
string body = _writer.ToString();
e.Message.IsBodyHtml = true;
e.Message.Subject = "New Password";
e.Message.Body = body;
But when I added <%Password %>
to get the password in the HTML line, I got the error:
The name 'Password' does not exist in the current context
What is wrong?
I solved my problem:
onSendingMail
events.<%Password%>
to get password where I want. (Also you can get <%UserName%>
.)mailBodyDefinition
from properties windowisBodyHTML = true