1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Forgotten Password Form

Discussion in 'C#' started by dog999, Jul 1, 2008.

  1. #1
    Hi,
    I have found a forgotten password script which all seems to work correctly, however, it sends the email using CDONTS which comes back with an error message...
    Microsoft VBScript runtime error '800a01ad'

    ActiveX component can't create object: 'CDONTS.NewMail'

    /admin/send_e-mail.asp, line 45


    with the script below..

    <!--#INCLUDE file="config.asp"-->
    <%
    strMode = request.querystring("mode")
    str_to = request.querystring("str_to")
    
    SQL="SELECT * FROM users where EMail ='" & str_to & "'"
    
    Set conn=Server.CreateObject("ADODB.Connection")
    Set RS = Server.CreateObject("ADODB.Recordset")
    
    conn.Open dsn
    rs.open sql, conn
    
    if strMode = "password" then
      if rs.EOF then
        CloseDB()
        Response.Redirect("forgot_password.asp?stat=bademl")
      end if
    
      str_subj = sitename & " Password Reminder"
    
      str_body = "Automated Password Reminder From " &sitename & vbCrLf
      str_body = str_body & "--------------------------------" & vbCrLf
      str_body = str_body & "UserName: " & RS("UserName") & vbCrLf
      str_body = str_body & "Password: " & RS("strPassword") & vbCrLf
    elseif strMode = "welcome" then
      str_subj = "Welcome to "& sitename
    
      str_body = "Welcome to " &sitename & vbCrLf
      str_body = str_body & "--------------------------------" & vbCrLf
      str_body = str_body & "UserName: " & RS("UserName") & vbCrLf
      str_body = str_body & "Password: " & RS("strPassword") & vbCrLf  
    else
      str_subj = sitename & " E-Mail Validation"
      str_body = "Please visit the following URL to validate your "&sitename&" membership. ("&ajloginurl&"validate.asp?n="&rs("confirmation_num")&")"
    end if
    
    CloseDB()
    
    Set mail = CreateObject("CDONTS.NewMail")
    mail.From    = str_from
    mail.To      = str_to
    mail.Subject = str_subj
    mail.Body    = str_body
    
    if strMode="password" then 
      if sendPassword = true then
        mail.Send
        set mail=nothing
        Response.Redirect("login.asp?stat=checkeml")
      else
        Response.Write(str_body)
      end if
    else
      mail.Send
      set mail=nothing
      Response.Redirect("login.asp?stat=checkeml")
    end if
    
    sub CloseDB()
      rs.Close
      conn.Close
      Set rs = Nothing
      Set conn = Nothing
    end sub
    %>
    Code (markup):
    so I have tried to use CDOSYS instead, but I'm an asp newbie, and it comes back with the error message...

    CDO.Message.1 error '80040220'

    The "SendUsing" configuration value is invalid.

    /admin/send_e-mail.asp, line 49


    This is the script using CDOSYS, with line 49 in red. Thanks in advance, Matt

    <!--#INCLUDE file="config.asp"-->
    <%
    strMode = request.querystring("mode")
    str_to = request.querystring("str_to")
    
    SQL="SELECT * FROM users where EMail ='" & str_to & "'"
    
    Set conn=Server.CreateObject("ADODB.Connection")
    Set RS = Server.CreateObject("ADODB.Recordset")
    
    conn.Open dsn
    rs.open sql, conn
    
    if strMode = "password" then
      if rs.EOF then
        CloseDB()
        Response.Redirect("forgot_password.asp?stat=bademl")
      end if
    
      str_subj = sitename & " Password Reminder"
    
      str_body = "Automated Password Reminder From " &sitename & vbCrLf
      str_body = str_body & "--------------------------------" & vbCrLf
      str_body = str_body & "UserName: " & RS("UserName") & vbCrLf
      str_body = str_body & "Password: " & RS("strPassword") & vbCrLf
    elseif strMode = "welcome" then
      str_subj = "Welcome to "& sitename
    
      str_body = "Welcome to " &sitename & vbCrLf
      str_body = str_body & "--------------------------------" & vbCrLf
      str_body = str_body & "UserName: " & RS("UserName") & vbCrLf
      str_body = str_body & "Password: " & RS("strPassword") & vbCrLf  
    else
      str_subj = sitename & " E-Mail Validation"
      str_body = "Please visit the following URL to validate your "&sitename&" membership. ("&ajloginurl&"validate.asp?n="&rs("confirmation_num")&")"
    end if
    
    CloseDB()
    
    Set myMail=CreateObject("CDO.Message")
    myMail.Subject= str_subj
    myMail.From= str_from
    myMail.To= str_to
    myMail.TextBody= str_body
    
    
    if strMode="password" then 
      if sendPassword = true then
        myMail.Send
        set myMail=nothing
        Response.Redirect("login.asp?stat=checkeml")
      else
        Response.Write(str_body)
      end if
    else
    [COLOR="red"]  myMail.Send[/COLOR]
      set myMail=nothing
      Response.Redirect("login.asp?stat=checkeml")
    end if
    
    sub CloseDB()
      rs.Close
      conn.Close
      Set rs = Nothing
      Set conn = Nothing
    end sub
    %>
    Code (markup):
     
    dog999, Jul 1, 2008 IP
  2. helpbeam

    helpbeam Guest

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Might be a permissions problem.
    Here's something I found on it

    Why do I get the error message "The SendUsing configuration value is invalid"?
    Possible solution:
    This problem occurs because read access to the Internet Information Services (IIS) metabase and the Microsoft Active Directory directory service has been removed for the Everyone group. This access has been removed because of a security modification in Exchange 2000 Server SP3. CDOEX, CDOSYS, and System.Web.Mail must have access to the IIS metabase to access information about the location of the pickup directory path. This behavior occurs when you use the Sendusingpickup method and if this information is not specified in the application code. Because access is restricted, the non-administrative user under whose security context the application is running cannot read this information from the IIS metabase and Active Directory. Fore more information refer Read Access to the Everyone Group Is Removed After You Install Exchange 2000 SP3
     
    helpbeam, Jul 2, 2008 IP