Send "Forgot password" reminder via email

Discussion in 'ASP General' started by groupie, Dec 30, 2007.

  1. groupie

    groupie Guest

    Hi,
    I'd like to know how to implement the "Forgot Password" feature on
    many websites which require a login, exactly like this ebay example:
    http://cgi4.ebay.com/ws/eBayISAPI.dll?UserIdRecognizerShow

    I've already retrieved the users password from the database - I just
    need to send it to the email address entered.

    From reading many posts, I need a server-side script and rather not
    use form mailto: nor use javascript on the users PC.

    Any help/pointers appreciated.
    groupie, Dec 30, 2007
    #1
    1. Advertising

  2. "groupie" <> wrote in message
    news:...
    > Hi,
    > I'd like to know how to implement the "Forgot Password" feature on
    > many websites which require a login, exactly like this ebay example:
    > http://cgi4.ebay.com/ws/eBayISAPI.dll?UserIdRecognizerShow
    >
    > I've already retrieved the users password from the database - I just
    > need to send it to the email address entered.
    >
    > From reading many posts, I need a server-side script and rather not
    > use form mailto: nor use javascript on the users PC.
    >
    > Any help/pointers appreciated.


    You are right you would never want any response going back to the client
    that contained the password.

    The email address should have been registered and verified as part of the
    account set up and therefore held in the DB already. The email address that
    you send should only be the one verified for the user account. Thus no one
    can impersonate a UserID and have the password sent to a different email
    address.

    Having pulled the email address and password from the DB you can use the
    following to send an email:-

    Sub SendPassword(rsEmail, rsPassword)

    Dim oMsg : Set oMsg = Server.CreateObject("CDO.Message")

    oMsg.To = rsEmail
    oMsg.Subject = "Your password"
    oMsg.HTMLBody = "<html><body>" & rsPassword & "</body></html>"
    Set oMsg.Configuration = GetConfig() 'delete if server already configured

    oMsg.Send

    End Sub

    Function GetConfig()

    Set GetConfig = Server.CreateObject("CDO.Configuration")

    With GetConfig.Fields
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
    "yourserver"
    .Update
    End With

    End Function

    Note that in GetConfig you need to replace "yourserver" with an SMTP server
    name that your Web server can use to send email. Alternative your site may
    be configured via IIS manager with these values, in which case you can
    delete the GetConfig stuff altogether.


    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Dec 30, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    994
  2. barry

    forgot password not working

    barry, Jul 15, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    647
    Juan T. Llibre
    Jul 15, 2006
  3. DDK

    Forgot Password encrypted email system

    DDK, Oct 26, 2003, in forum: ASP .Net Security
    Replies:
    1
    Views:
    166
    Nicole Calinoiu
    Oct 26, 2003
  4. Replies:
    1
    Views:
    158
  5. John

    Form Authentication - Forgot Password

    John, Aug 27, 2007, in forum: ASP .Net Security
    Replies:
    1
    Views:
    531
    Andreas Kraus
    Aug 31, 2007
Loading...

Share This Page