在 ASP.Net 中 - 我正在使用内置的密码恢复向导。
是否有任何方法可以将 SMTP 身份验证添加到邮件身份验证向导 - 而无需将其添加到 web.config?或者可以在代码隐藏的某个地方注入它吗?
我的 aspx 代码如下 - 目前没有代码隐藏:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server" borderStyle="None"
borderWidth="1px" Font-Size="10pt" Font-Names="Verdana" onsendingmail="PasswordRecovery1_SendingMail">
<TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="#FFFFFF" />
<MailDefinition From="info@mydomain.co.uk" Priority="High"
Subject="My Domain - new, temporary password" BodyFileName="forgotpassword.txt">
</MailDefinition>
<UserNameTemplate>
<table border="0" cellpadding="1" cellspacing="0"
style="border-collapse:collapse;">
<tr>
<td>
<table border="0" cellpadding="0">
<tr>
<td align="center" colspan="2" style="font-family:Arial;font-size:Small;">
Enter your User Name to receive your password.</td>
</tr>
<tr>
<td align="right" style="font-family:Arial;font-size:Small;">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="PasswordRecovery1">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit"
ValidationGroup="PasswordRecovery1" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</UserNameTemplate>
</asp:PasswordRecovery>
目前我刚刚收到消息:
System.Net.Mail.SmtpFailedRecipientException 邮箱不可用。服务器响应是:必须经过身份验证