Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 3.5 and Visual Studio. 2008 > .NET Framework 3.5
.NET Framework 3.5 For discussion of the Microsoft .NET Framework 3.5.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 3.5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 20th, 2010, 06:21 AM
Registered User
Join Date: Feb 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default The server response was: 5.7.0 Must issue a STARTTLS command first. 14sm672265ewy.3


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="[email protected]"

the code that i include it in the web config:
<smtp deliveryMethod="Network" from="[email protected] ">
<network host="smtp.gmail.com" port="587" userName="[email protected]" password="Mypassword" defaultCredentials="true"/>

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("[email protected]"));
mySmtpClient.Port = 587;
mySmtpClient.Credentials = new System.Net.NetworkCredential("[email protected] ", "MyPassword");
mySmtpClient.EnableSsl = true;

protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.EnableSsl = true;
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....
i will be faithful please any help i need it


Last edited by ghadeer_; February 20th, 2010 at 06:27 AM.. Reason: not complete
Old April 13th, 2010, 07:06 AM
Registered User
Join Date: Apr 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default reply

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:When i did my mcts form Microsoft i realized what a vast knowledge they have.
Look your problem there and the related ans too
Dim mm As New MailMessage()

            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
Old May 13th, 2010, 04:59 PM
Friend of Wrox
Join Date: Sep 2009
Posts: 165
Thanks: 5
Thanked 6 Times in 6 Posts

Well I have using emails for the last 7 months and I did not have any problem yet but suddenly now emails are not being delivered neither from local site not from remote site.
I have tried your method also but it is not working. I have not changed even single word of code but messages are not being delivered.
May you please help me out.

My web.config file is
			<smtp from="Jack &lt;<user name>@gmail.com&gt;" deliveryMethod="Network">
				<network host="smtp.gmail.com" userName="<user name>" password="<password>" port="587" />
		<add key="MailFromAddress" value="<user name>@gmail.com"/>
		<add key="MailToAddress" value="<user name>[email protected]"/>
I also have tried changing port no. and I DID NOT CHANGE ANY THING SINCE LAST FUNCTIONING.
Then why it is happening suddenly, please tell me how it can be solved.

When ever I look for the exception raised then it shows the following error message now
The remote certificate is invalid according to the validation procedure.
What wrong has gone suddenly as there was no such error or problem earlier.
Please help me, any help is appreciated.

Thank You
Jack: Founder, Developer & Owner Of JackAndGenieForever.Com
Old May 13th, 2010, 05:40 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Cross post: http://p2p.wrox.com/asp-net-3-5-prof...-new-post.html

Why are you posting this here? Aren't you asking this question (and being helped) in the topic above?

Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Old May 23rd, 2010, 10:57 PM
Registered User
Join Date: Feb 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default oooh yaa

this question i have asked it befor that if you see ....thank you your code is work very well

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter Nine: Must issue a STARTTLS areed24 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 25 September 22nd, 2009 02:00 AM
Chapter 9 & 10 starttls tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 May 3rd, 2009 06:29 AM
Response.BinaryWrite issue alliancejhall ASP.NET 2.0 Basics 1 November 14th, 2007 11:29 PM
Issue in creating Dll in command prompt using vb6 Thangaraja VB Components 0 February 3rd, 2005 08:16 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.