The SMTP server requires a secure connection or the client was not authenticated
2009-12-03 21:41
489 查看
From: http://forums.asp.net/t/1199382.aspx
heelo, i have a register.aspx file. When i am going to complete the registration i get an error
Register.aspx code
Web.Config
Error I get
Help
Thank you in Advance
====================
If you're sending email through an SSL SMTP like GMail, then you have to set the SmtpClient.EnableSsl to True. About the only way to do this is to override the email functionality of CreateUserWizard. Use the SendingMail event method to define your MailMessage and SmtpClient and then use the Cancel property to prevent the CreateUserWizard from sending its automated email.
====================
You can refer to some of my previous posts
http://forums.asp.net/p/1156294/1899489.aspx#1899489
http://forums.asp.net/p/1144253/1848821.aspx#1848821
http://forums.asp.net/p/1117050/1736785.aspx#1736785
heelo, i have a register.aspx file. When i am going to complete the registration i get an error
Register.aspx code
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" CancelDestinationPageUrl="~/error.htm" CompleteSuccessText="Your account has been successfully created.You can now log in" ContinueDestinationPageUrl="~/Default.aspx" DisplayCancelButton="True" DuplicateUserNameErrorMessage="This username already exists.Please enter a different user name." FinishDestinationPageUrl="/Default.aspx" Font-Size="10pt" SkipLinkText="Skip" MailDefinition-BodyFileName="~/registration.txt" MailDefinition-From="mygmailname@gmail.com" MailDefinition-Priority="High" MailDefinition-Subject="Activate your WebSite Account" MailDefinition-IsBodyHtml="true" Width="310px" LoginCreatedUser="False" > <WizardSteps> <asp:CreateUserWizardStep runat="server"> </asp:CreateUserWizardStep> <asp:CompleteWizardStep runat="server"> </asp:CompleteWizardStep> </WizardSteps> </asp:CreateUserWizard>
Web.Config
<mailSettings> <smtp from="mygmailname@gmail.com"> <network host="smtp.gmail.com" userName="mygamailname@gmail.com" password="mypass" defaultCredentials="true" /> </smtp> </mailSettings>
Error I get
Server Error in '/' Application. -------------------------------------------------------------------------------- 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 j12sm16503842fkf.6 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.Mail.SmtpException: 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 j12sm16503842fkf.6 Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SmtpException: 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 j12sm16503842fkf.6] System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) +849368 System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, String from) +39 System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException& exception) +95 System.Net.Mail.SmtpClient.Send(MailMessage message) +2004 System.Web.UI.WebControls.LoginUtil.SendPasswordMail(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +341 System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +571 System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +105 System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +453 System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +149 System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +17 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.312; ASP.NET Version:2.0.50727.833
Help
Thank you in Advance
====================
If you're sending email through an SSL SMTP like GMail, then you have to set the SmtpClient.EnableSsl to True. About the only way to do this is to override the email functionality of CreateUserWizard. Use the SendingMail event method to define your MailMessage and SmtpClient and then use the Cancel property to prevent the CreateUserWizard from sending its automated email.
====================
You can refer to some of my previous posts
http://forums.asp.net/p/1156294/1899489.aspx#1899489
http://forums.asp.net/p/1144253/1848821.aspx#1848821
http://forums.asp.net/p/1117050/1736785.aspx#1736785
相关文章推荐
- IOS9网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
- EX:The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
- The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure
- Server was unable to process request. ---> System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
- The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure
- The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid
- [转] --- Error: “A field or property with the name was not found on the selected data source” get only on server
- The underlying connection was closed:Could not establish trust relationship for the SSL/TLS secure
- VMware View client连接错误:A secure connection to the server '(null)' cannot be established
- AFNetworking 提示"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection" 解决办法
- 连接数据库时的异常:TNS:listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: localhost:1521:orc
- Xcode7 beta 网络请求报错:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
- The server cannot or will not process the request due to something that is perceived to be a client
- The resource could not be loaded because the App Transport Security policy requires the use of a secure connection
- AFNetworking 提示"The resource could not be loaded because the App Transport Security policy requires the use of a secure connection" 解决办法
- 【错误】:Could not open JDBC Connection for transaction; nested exception is: Communications link failure;The last packet sent successfully to the server was 1 milliseconds ago