How do one configure a system .net Email in vwd for password recovery

Discussion in 'ASP.NET 2.0' started by bigmike40, Mar 28, 2007.

  1. I've trying to configure my smtp account in web.config to work with my membership role login control for password recovery
    but i cannot seem to get it to work. can someone give me an example
    Thanks
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    Do you get any exceptions? Are you setting the SMTP setting in the web.config correctly? Make sure you set the SMTP server to localhost.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. Is there any article here on how to setup the email
     
  4. Most of us are using full Visual Studio versions.
    Many of us help with code where we can...
    What I'm not sure of is how VWD handles all of VS 2005 code.
    My guess is anything we post for ASP.NET 2.0 should work with VWD but please bear with us. [​IMG]

    Take a look at this, see if it helps a bit:
    http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx

    Keep in mind your web.config mail section should look like this for DASP accounts:
    <system.net>
    <mailSettings>
    <smtp>
    <network host="localhost" port="25"/>
    </smtp>
    </mailSettings>
    </system.net>
     
  5. You generally don't need to set the system.net mailSettings in your application's web.config as this is already configured in the server's global web.config. If you are using the PasswordRecovery control, don't forget to set the maildefinition-from property or the the SMTP server won't send the email.

    For example:

     
  6. I have tryed but i keep thisgetting this error




    Server Error in '/' Application.


    A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
     
  7. Bruce

    Bruce DiscountASP.NET Staff

    Are you running the application locally or on our server?

    You probably have the SMTP server set incorrectly based on the error message.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  8. No i'm not running it locally and pretty much all the info is correct is possiable that my port is block via my local isp provider
     
  9. Bruce

    Bruce DiscountASP.NET Staff

    ISP blocking SMTP port is very likely the cause of the problem. Try switch the SMTP to their server and see if it works.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  10. I was ableto us my local isp and it works fine using port 587 but once i change back my WEB.config to port 25 it fail local. So i went into tool, emailaccount in outlook 03
    and setup theaccount using all the server info ,and once i did a test connection setting using port 25 it passes. But when i change the port to 587 it fail the test which indicated to me that the server is using port 25 and not 587 and my local ISP is blockingport 25 because i cannot connect locally in VWD 05using port 25 only 587.
    So i have to figure out how change the port so that my locall and the server is on the same
     
  11. Bruce

    Bruce DiscountASP.NET Staff

    You should always use "localhost" when you send from our server.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  12. I was looking a around and i found this article here and i was trying to use it in my event handle but it coming up with errors
    too much html tags.Is this tag correct
    <%@ Page Language="VB" %>
    <%@ Import Namespace="System.Net.Mail" %>
    <script runat="server">
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Dim strFrom = "[email protected]"
    Dim strTo = "[email protected]"
    Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
    MailMsg.BodyEncoding = Encoding.Default
    MailMsg.Subject = "Subject"
    MailMsg.Body = "This is a sample message"
    MailMsg.Priority = MailPriority.High
    MailMsg.IsBodyHtml = True

    'Smtpclient to send the mail message
    Dim SmtpMail As New SmtpClient
    SmtpMail.Host = "localhost"
    SmtpMail.Send(MailMsg)
    lblMessage.Text = "Mail Sent"

    End Sub
    </script>
    <html>

    <form runat="server">
    <asp:Label id="lblMessage" runat="server"></asp:Label>
    </form>
    </body>
    </html>
     
  13. i'm getting the error when i ever i run it the debug in vwd05 .It said too much html tags .
    Beside do ihave to add an event handle script to get the webserver to send forgotpassword idemail or just the script in the web.config is all i need
    Thanks
     
  14. This is when i fired the passwordrecovery id button

    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 g9sm7089992wra 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 g9sm7089992wra
     

Share This Page