我正在使用 asp 中的“createuserwizard”创建一个表单。这是我的代码。
<asp:CreateUserWizard ID="userwizard" ContinueDestinationPageUrl="~/secretfiles/secret.aspx" runat="server" >
<MailDefinition BodyFileName="register.txt" Subject="Registration Confirmation" From="amrit.enest@gmail.com" />
</asp:CreateUserWizard>
这是我的 web.config 文件设置。
<mailSettings>
<smtp deliveryMethod="Network" from="amrit.enest@gmail.com">
<network host="smtp.gmail.com" port="25" userName="amrit.enest@gmail.com" password="sending emails's password" />
</smtp>
</mailSettings>
然后设置 Smtp。在 ISS 设置中我选择了以下选项。
->Use localhost(SMTP)
->port=25
->authentication not required
现在,当新用户点击提交按钮时,它会给出以下错误消息并且邮件不会被发送。
SMTP 服务器需要安全连接或客户端未通过身份验证。服务器响应是:5.7.0 必须先发出 STARTTLS 命令。 ud8sm21095949igb.4
请大家帮忙
最佳答案
使用 enableSsl="true"
,像这样:
<mailSettings>
<smtp deliveryMethod="Network" from="amrit.enest@gmail.com">
<network enableSsl="true" host="smtp.gmail.com" port="25" userName="amrit.enest@gmail.com" password="sending emails's password" />
</smtp>
</mailSettings>
关于c# - SMTP 服务器需要安全连接或客户端未通过身份验证。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11795435/