I have currently setup a basic开发者_Python百科 membership system in ASP.NET and have used the
<asp:PasswordRecovery ID="PasswordRecovery1" Runat="server"></asp:PasswordRecovery>
To deal with the password recovery, Which Works great but how would one customise the e-mail such as changing the"Subject" and the actual body content of the e-mail ?
Implement the OnSendingMail event for the passwordrecovery control.
the parameter (MailMessageEventArgs e) is the MailMessage object and you can update the subject/body etc fields before the message is actually sent.
Please see David Winchester's answer at this link https://forums.asp.net/post/3167737.aspx
I've edited his answer as following:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server">
        <MailDefinition 
            From="noreply@gmail.com" 
            Subject="Your temporary password!" 
            IsBodyHtml="true" 
            Priority="High" 
            BodyFileName="~/Templates/PasswordRecoveryMail.htm">
        </MailDefinition>
    </asp:PasswordRecovery>
Content of PasswordRecoveryMail.htm file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <div>
        Please return to the site and log in using the following information. 
    </div>
<p>Username: <%UserName%></p>
    <p>Password: <%Password%></p>
</body>
</html>
You can edit the MailDefinition settings.
MailDefinition-BodyFileName="uri"
MailDefinition-CC="string"
MailDefinition-From="string"
MailDefinition-IsBodyHtml="True|False"
MailDefinition-Priority="Normal|Low|High"
MailDefinition-Subject="string"
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论