我創建了我的web應用程序和用戶PasswordRecovery
控件。 我的HTML代碼:asp.net中的PasswordRecovery控件
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server">
<MailDefinition From="[email protected]" Subject="ResetPassword"
Priority="High"/>
</asp:PasswordRecovery>
而且我的web.config代碼:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="[email protected]">
<network
host="smtp.gmail.com"
port="25"
password="xxxxxxx"
defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
但我得到這些錯誤,這是行不通的。
1-SMTP服務器需要安全連接或客戶端未通過身份驗證。服務器響應是:5.5.1需要身份驗證。
2-A連接嘗試失敗,因爲連接的方沒有正確一段時間後響應或已建立的連接失敗,因爲連接的主機未能響應173.194.66.109:25
我的web.config代碼是
<configuration>
<system.web>
<roleManager enabled="true" />
<authentication mode="Forms" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<!-- ... -->
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.gmail.com" password="mypassword"
enableSsl="true" port="578" userName="[email protected]" />
</smtp>
</mailSettings>
</system.net>
</configuration>
和形狀:
<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/master-store.Master"
AutoEventWireup="true" CodeBehind="UserPasswordRecovery.aspx.cs"
Inherits="Store.Pages.userpasswordrecovery" %>
<!-- ... -->
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="wrapper">
<div class="wrapper-rim">
<div class="site-content">
<div class="recovery-password" dir="rtl">
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server"/>
</div>
</div>
</div>
</div>
</asp:Content>
焯芬此鏈接。 [此處輸入鏈路描述] [1] [1]:http://stackoverflow.com/questions/6097333/the-smtp-server-requires-a-secure-connection-or客戶端未被認證 – Raghubar