Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    124

    Unanswered: CDO.Message question

    I'm using the following code to auto generate an email to users that have forgotten a logon password.

    <%
    Dim rsEmail__strEmail
    rsEmail__strEmail = "1"
    If (Request.Form("Email") <> "") Then
    rsEmail__strEmail = Request.Form("Email")
    End If
    %>
    <%
    Dim rsEmail
    Dim rsEmail_numRows

    Set rsEmail = Server.CreateObject("ADODB.Recordset")
    rsEmail.ActiveConnection = MM_DBConn_STRING
    rsEmail.Source = "SELECT Email,Pswrd FROM dbo.tblLogin WHERE Email = '" +
    Replace(rsEmail__strEmail, "'", "''") + "'"
    rsEmail.CursorType = 0
    rsEmail.CursorLocation = 2
    rsEmail.LockType = 1
    rsEmail.Open()

    rsEmail_numRows = 0

    IF rsEmail.EOF THEN
    Response.Write "That email address was not found in our database. Please
    click Back on your browser and enter the email address you registered with."
    ELSE
    DIM strPassword
    strPassword = rsEmail("Pswrd")

    sch = http://schemas.microsoft.com/cdo/configuration/
    mailbody = "Here is your login password: " & rsEmail__strEmail

    Set cdoConfig = CreateObject("CDO.Configuration")

    With cdoConfig.Fields
    .Item(sch & "sendusing") = 2 ' cdoSendUsingPort
    .Item(sch & "smtpserver") = "mail.softscience.com"
    .update
    End With

    Set cdoMessage = CreateObject("CDO.Message")

    With cdoMessage
    Set .Configuration = cdoConfig
    .From = "dwayneepps@response.com"
    .To = rsEmail__strEmail
    .Subject = "Dwayne-Epps-Weblog-Password-Request"
    .HTMLBody = mailbody
    .Send
    End With

    Set cdoMessage = Nothing
    Set cdoConfig = Nothing
    Response.Write "Your password has been sent to your email address."
    %>
    <%
    rsEmail.Close()
    Set rsEmail = Nothing
    End If
    %>

    The strange thing is that if I test the above script on my local testing
    server it will work if I use the following line without quotations marks:

    sch = http://schemas.microsoft.com/cdo/configuration/

    In order for the script to work in the production environment I have to add
    quotation marks like so:

    sch = "http://schemas.microsoft.com/cdo/configuration/"

    Any idea as to what the difference is and why this happens? This is the
    only thing that I have to change for it to work on the remote production
    server? I'd like to understand why so I can correct it to work the same on
    both my local testing server and the remote production server. Thanks for any help.
    -Dman100-

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I'm not sure why it is working without the quotes. I would have expected it to fail on your local server... unless it is failing but is finding some other way to succeed.... like it is using the defaults....

  3. #3
    Join Date
    Jan 2004
    Posts
    124
    Hi rokslide,

    Okay, I figured the quotes were necessary. Is there a special configuration necessary to setup on the server to run this script? When I setup the server, I just installed IIS and SQL Server. I assume the components are just standard that come with Win2000 Server?

    I didn't do any special configuration, so that might be the problem?

    Any thoughts?

    Thanks for your help!
    -Dman100-

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    I'm not sure what I did when I last played with this but I suspect you need to make sure you are running an smtp server on your local machine as well.... sorry I can't add more helpful advice, when I tried it it just worked.... *shrug*

  5. #5
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Do you get an error? Or does it run, but no mail is delivered?
    That which does not kill me postpones the inevitable.

  6. #6
    Join Date
    Jan 2004
    Posts
    124
    Hi Seppuku,

    When I include the quotation marks and run the script on my local testing server an error is thrown. The error is thrown at the following line in the code:
    .Send

    If I don't use the qoutation marks and run the script on my local testing server the script is run and mail is delivered to my email address.

    After researching online, I figure I need to setup the Default SMTP Virtual Server running under IIS.

    I have a 4500 Proliant Server running Win2K Server that I use as a
    testing/development server for web apps. I run this at my home on a small
    LAN. The LAN includes two win2k pro pc's and the win2K server connected via a linksys router.

    I'm not sure how I would configure the Default SMTP Virtual Server so I can test my web apps using CDO.Message. I'm only interested in configuring for my LAN, so I can pull up a web app on the localhost and test contact forms to make sure they send email properly before uploading to the remote production server.

    I'm completely new to working with SMTP Virtual Server. I've been looking
    at some online resources I've found and attempting to configure SMTP Server to work properly, but to no avail.

    Any suggestions on how I can can go about setting up the smtp virtual server for the above scenario?

    I apologize for the novice question, and if I've neglected to include any
    information that would be helpful, please let me know. Thanks for replying to my post. I appreciate the help.
    -Dman100-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •