Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm using asp's password recovery control and in the forget password link have a problem when lunch my web application get this error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

my web.config code is like blow:

XML
<configuration>
  <system.web>
    <roleManager enabled="true" />
    <authentication mode="Forms" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=SadeQ-PC;Initial Catalog=HCSWA;Integrated Security=True;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" lockItem="false"/>
  </appSettings>
<system.net>
    <mailSettings>
        <smtp from="hsadeghi.t@gmail.com">
            <network host="smtp.gmail.com" password="mypassword" enableSsl="true" port="578" userName="hsadeghi.t@gmail.com" />
        </smtp>
    </mailSettings>
  </system.net>

</configuration>



and my form code is :
XML
<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/master-store.Master" AutoEventWireup="true" CodeBehind="UserPasswordRecovery.aspx.cs" Inherits="Store.Pages.userpasswordrecovery" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CSSPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="JSPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content4" 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"></asp:PasswordRecovery>
                </div>
            </div>
        </div>
    </div>
</asp:Content>


I'd read every post and tutorial that been in google search some body said enableSsl have to be "true" but it wasn't work. I'd think I've some problem in my google's account authentication any body have some information?
i using .NET 4.5
Posted
Updated 24-Jul-13 5:46am
v2

Hello Sadeq,

Just to give you more insight on SMTP authentication here is a small excerpt from wikipedia.
From Wikipedia
Differently from mail-access protocols, the original SMTP specified by Jon Postel in the 1970s did not provide for using passwords for sending email messages. This lack of security gave rise to open mail relays, unprotected mail servers used to propagate spam and worms that became a plague in the late '90s.[2] Before SMTP AUTH, a relay client had to be identified by IP address, which is only practical for email services provided by the same Internet service provider (ISP) supplying the connection, or else using specific hacks, such as POP before SMTP.

John Gardiner Myers published the first draft of SMTP AUTH in 1995, and it has been successively developed and discussed in the IETF along with mail submission protocol, Extended SMTP (ESMTP), and Simple Authentication and Security Layer (SASL). An older SASL mechanism for ESMTP authentication (ESMTPA) is CRAM-MD5, and uses of the MD5 algorithm in HMACs (hash-based message authentication codes) are still considered sound.

From the error description it looks like your SMTP server does not allow it to be used as Open Relay & requires authentication before an email can be sent out. You can ask your administrator to allow sending emails from the IP address of the server on which your ASP.Net application, but it's not really a good idea. Instead check your web.config and in that check the mailsettings element. It should something like one shown below.
XML
<mailSettings>
    <smtp deliveryMethod="network" from="ben@contoso.com">
        <network 
            host="host name"  
            port="integer"  
            defaultCredentials="true|false" 
            userName="string" 
            password="string"/>
    </mailSettings>

Regards,
 
Share this answer
 
Comments
SadeqHatami 24-Jul-13 15:06pm    
i try this soluotion
and get this error

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. ei10sm1012854wid.0 - gsmtp
Boipelo 24-Jul-13 17:24pm    
Log on to your gmail account, you might find a warning message saying an application has been trying to send messages on your behalf. If so, follow the link on the message to allow that IP to send messages on your behalf.
SadeqHatami 25-Jul-13 2:28am    
i login in my gamil account,but no any mail recived for warning message :(
SOLVED!!!!

i try this code

<system.net>
<mailsettings>
<smtp deliverymethod="Network" from="mymail@gmail.com">
<network>
host="smtp.gmail.com"
enableSsl="true"
port="587"
defaultCredentials="false"
userName="mymail@gmail.com" //same from
password='mypassword'/>


 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900