If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > CDO.Message question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-31-04, 18:41
-Dman100- -Dman100- is offline
Registered User
 
Join Date: Jan 2004
Posts: 124
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-
Reply With Quote
  #2 (permalink)  
Old 08-31-04, 19:16
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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....
Reply With Quote
  #3 (permalink)  
Old 08-31-04, 19:22
-Dman100- -Dman100- is offline
Registered User
 
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-
Reply With Quote
  #4 (permalink)  
Old 08-31-04, 19:59
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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*
Reply With Quote
  #5 (permalink)  
Old 09-01-04, 10:50
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #6 (permalink)  
Old 09-01-04, 16:17
-Dman100- -Dman100- is offline
Registered User
 
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-
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On