Asp.net <;asp:PasswordRecovery>;如何定制发送给用户的电子邮件?
我目前在ASP.NET中设置了一个基本的会员系统,并使用了Asp.net <;asp:PasswordRecovery>;如何定制发送给用户的电子邮件?,asp.net,asp.net-membership,password-recovery,customising,Asp.net,Asp.net Membership,Password Recovery,Customising,我目前在ASP.NET中设置了一个基本的会员系统,并使用了 <asp:PasswordRecovery ID="PasswordRecovery1" Runat="server"></asp:PasswordRecovery> 处理密码恢复,这很有效,但如何定制电子邮件,例如更改电子邮件的“主题”和实际正文内容 您可以编辑设置 MailDefinition-BodyFileName="uri" MailDefinition-CC="string" MailDefin
<asp:PasswordRecovery ID="PasswordRecovery1" Runat="server"></asp:PasswordRecovery>
处理密码恢复,这很有效,但如何定制电子邮件,例如更改电子邮件的“主题”和实际正文内容 您可以编辑设置
MailDefinition-BodyFileName="uri"
MailDefinition-CC="string"
MailDefinition-From="string"
MailDefinition-IsBodyHtml="True|False"
MailDefinition-Priority="Normal|Low|High"
MailDefinition-Subject="string"
为passwordrecovery控件实现OnSendingMail事件
参数(MailMessageEventArgs e)是MailMessage对象,您可以在消息实际发送之前更新主题/正文等字段。请参阅此链接上的David Winchester的答案 我将他的答案编辑如下:
<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>
PasswordRecoveryMail.htm文件的内容
<!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>
请返回该站点并使用以下信息登录。
用户名:
密码:
如何更改电子邮件内容?