Having typed the code out about tha passsword recovery control and I get the following 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. 14sm672265ewy.3
please any help i will be faithful..
my code as follows in aspx file:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server" OnSendingMail="PasswordRecovery1_SendingMail" >
<MailDefinition BodyFileName="~/EmailTemplate/PasswordRecovery.txt"
Subject="your password has been reset..." From="temn.cis.just@gmail.com"
Priority="High">
the code that i include it in the web config:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="myUserName@gmail.com ">
<network host="smtp.gmail.com" port="587" userName="MyUserNamer@gmail.com" password="Mypassword" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
and the code that included in the aspx.cs file is:
the text that i include it in the PasswordRecovery.txt is:
Your password has been reset, <%UserName%>!
According to our records, you have requested that your password be reset.
Your new password is: <%Password%>
If you have any questions or trouble logging on please contact a site administrator.
Thank you!
to give that user random password and user name to get log in again....
cheers
i will be faithful please any help i need it
Also, remove the settings in the web.config. Folllowing is the sample code that sends a simple email using Gmail smtp, it is in VB but you can surely have an idea:
Dim mm As New MailMessage()
mm.To.Add("toAddress")
<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">hello adeelehsan </div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x:
hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">i have made what you said exactly</div> <div style="position: absolute;
left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">1-
i have used the 465 port.</div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height:
1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">but now i have another problem which is :</div>
hello adeelehsan
i have made what you said exactly
1- i have used the 465 port.
but now i have another problem which is :
Exception Details: System.Net.Mail.SmtpException: The operation has timed out.
with this:
Source Error:
Line 86: ss.Credentials = new System.Net.NetworkCredential("MyUserName@gmail.com", "MyPassword");
Line 87: ss.EnableSsl = true;
Line 88: ss.Send(mm);
but look if i used 587Port for the gmail outgoing server the message is sent with it's properties but with 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. 14sm672265ewy.3
Because Gmail requires a different port as the default port, are you sure your (shared ?) hosting provider allow you to use this port? So please ask, otherwise all your efforts are usesless...
ghadeer_
0 Points
3 Posts
i have a problem with password recovery control
Feb 20, 2010 09:42 AM|LINK
Hello,
Having typed the code out about tha passsword recovery control and I get the following 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. 14sm672265ewy.3
please any help i will be faithful..
my code as follows in aspx file:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server" OnSendingMail="PasswordRecovery1_SendingMail" >
<MailDefinition BodyFileName="~/EmailTemplate/PasswordRecovery.txt"
Subject="your password has been reset..." From="temn.cis.just@gmail.com"
Priority="High">
the code that i include it in the web config:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="myUserName@gmail.com ">
<network host="smtp.gmail.com" port="587" userName="MyUserNamer@gmail.com" password="Mypassword" defaultCredentials="true"/>
</smtp>
</mailSettings>
</system.net>
and the code that included in the aspx.cs file is:
protected void Page_Load(object sender, EventArgs e)
{
MailMessage myMessage = new MailMessage();
SmtpClient mySmtpClient = new SmtpClient();
myMessage.To.Add(new MailAddress("MyUserName@gmail.com"));
mySmtpClient.Port = 587;
mySmtpClient.Credentials = new System.Net.NetworkCredential("MyUserName@gmail.com ", "MyPassword");
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(myMessage);
}
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(e.Message);
e.Cancel = true;
}
the text that i include it in the PasswordRecovery.txt is:
Your password has been reset, <%UserName%>!
According to our records, you have requested that your password be reset.
Your new password is: <%Password%>
If you have any questions or trouble logging on please contact a site administrator.
Thank you!
to give that user random password and user name to get log in again....
cheers
i will be faithful please any help i need it
ghader
Asp .net 3.5
adeelehsan
All-Star
18279 Points
2733 Posts
Re: i have a problem with password recovery control
Feb 21, 2010 06:33 AM|LINK
Hi
Try after removing the following line of code:
mySmtpClient.Port = 587;
If it does n't work, try using the port 465.
Also, remove the settings in the web.config. Folllowing is the sample code that sends a simple email using Gmail smtp, it is in VB but you can surely have an idea:
Dim mm As New MailMessage()
mm.To.Add("toAddress")
mm.From = New MailAddress("FromAddress")
mm.Subject = "Test Subject"
mm.Body = "Message Details"
Dim ss As New SmtpClient("smtp.gmail.com")
ss.Credentials = New System.Net.NetworkCredential("username","password")
ss.EnableSsl = True
ss.Send(mm)
The above code will work, if you are not behind a proxy and directly connected to the internet.
asp .net 2. 0
MCPD ASP.NET 4.0 and 3.5, MCTS WSS, MOSS, SharePoint 2010, MCT
Microsoft Community Contributor Award 2011
ghadeer_
0 Points
3 Posts
Re: i have a problem with password recovery control
Feb 21, 2010 03:56 PM|LINK
hello adeelehsan
i have made what you said exactly
1- i have used the 465 port.
but now i have another problem which is :
Exception Details: System.Net.Mail.SmtpException: The operation has timed out.
with this:
Source Error:
Line 86: ss.Credentials = new System.Net.NetworkCredential("MyUserName@gmail.com", "MyPassword");
Line 87: ss.EnableSsl = true;
Line 88: ss.Send(mm);
but look if i used 587Port for the gmail outgoing server the message is sent with it's properties but with 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. 14sm672265ewy.3
really i don't know what to do
please if you have any information i need it
as.net3.5
adeelehsan
All-Star
18279 Points
2733 Posts
Re: i have a problem with password recovery control
Feb 22, 2010 05:27 AM|LINK
Hi
Try with the following 2 make sures:
1) Do not use any port
2) Make sure you are not behind a proxy.
asp .net 2. 0
MCPD ASP.NET 4.0 and 3.5, MCTS WSS, MOSS, SharePoint 2010, MCT
Microsoft Community Contributor Award 2011
ghadeer_
0 Points
3 Posts
Re: i have a problem with password recovery control
Feb 22, 2010 06:24 AM|LINK
i have try without any port >>the exception that appeared that you have not specified any port fo rthe smtp server
am sure that i am not behind a proxy...
shall i have any setting related to the gmail mail that i sent from it ????
Jerry Weng -...
All-Star
29527 Points
3488 Posts
Re: i have a problem with password recovery control
Feb 24, 2010 04:45 AM|LINK
Hi,
Try to delete some code like below:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="myUserName@gmail.com ">
<network host="smtp.gmail.com" port="587" enableSsl="true" userName="MyUserNamer@gmail.com" password="Mypassword"
defaultCredentials="true"/></smtp>
</mailSettings>
</system.net>
and the code that included in the aspx.cs file is:
protected void Page_Load(object sender, EventArgs e)
{
MailMessage myMessage = new MailMessage();
SmtpClient mySmtpClient = new SmtpClient();
myMessage.To.Add(new MailAddress("MyUserName@gmail.com"));
mySmtpClient.Port = 587;
mySmtpClient.Credentials = new System.Net.NetworkCredential("MyUserName@gmail.com ", "MyPassword");
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(myMessage);
}
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.EnableSsl = true;
mySmtpClient.Send(e.Message);
e.Cancel = true;
}
hans_v
All-Star
35986 Points
6550 Posts
Re: i have a problem with password recovery control
Feb 24, 2010 10:39 AM|LINK
Because Gmail requires a different port as the default port, are you sure your (shared ?) hosting provider allow you to use this port? So please ask, otherwise all your efforts are usesless...