Wrox Programmer Forums
|
ASP CDO As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP CDO section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2004, 11:23 AM
Authorized User
 
Join Date: Mar 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to stellabantug
Default

Imar-

I think all of this coding may have affected me over the weekend and that is why I was sick... hahahaha!

So, what you want me to do is delete the "DRIVER={Microsoft Access Driver (*.mdb)}" from the global.asa file? I already did this and it still can not find the DSN.

Should I just give up on this?

 
Old March 22nd, 2004, 12:53 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No, of course you shouldn't give up. You're very close.

Are you sure your DSN is setup correctly? What is its name? What is the type (file, user, system)? To what database does it point? Is the database valid?

If you are in control of your server, I'd suggest you drop the DSN entirely. Using a "normal" OleDb connection string is much easier to maintain and setup. Something like this would work perfectly:

Application("SampDatabConn_ConnectionString") = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=" & Server.MapPath("/Databases/MyDB.mdb") & _
           "User Id=admin;" & _
           "Password="

I posted that in my previous message. Did you try that?

If you need more info about creating the actual connection string, look here:
http://msdn.microsoft.com/library/de...ml/ima0086.asp

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 22nd, 2004, 01:01 PM
Authorized User
 
Join Date: Mar 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to stellabantug
Default

Imar-

I FINALLY GOT IT TO WORK!!!!

i think it was a problem with the registry and permissions, but now it works. One problem, though, this online form is supposed to send the results of the form to a database and will also send an email confirmation. It correctly sends the results to the database, however the email aspect of it is not working.

This is the error email that I get:
-------------------------------------------

The following message arrived with illegal envelope data, typically a
mangled address that doesn't obey the RFC822/976 protocol specification.
If you do not recognize the source of the bad header, perhaps you should
contact a Postmaster at your site and ask why your mail was rejected.

Your message is being returned unprocessed.

The following annotated envelope headers illustrate the error(s):



Error in "to" envelope address:

<@advocatehealth.com>
                            ^-illegal token in route, expected word, illegal end of route address


Error in "Cc" header address:

<@advocatehealth.com>
                            ^-illegal token in route, expected word, illegal end of route address

----------------------------------------------------------

Below is the code that I have:

----------------------------------------------------------
Dim objCDOSYSMail
Dim strFrom
Dim strTo
Dim strCc
Dim strBcc
Dim strSubject
Dim strBody

strFrom=Request.Form("ReqEmail")& "@advocatehealth.com"
strTo="[email protected]"
strSubject = "Research Request Confirmation Page"
strCc=Request.Form("VPEMail") & "@advocatehealth.com"
strBcc=Request.Form("ReqEmail") & "@advocatehealth.com"

Set objCDOSYSMail = Server.CreateObject("CDO.Message")

objCDOSYSMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "moat.advocatehealth.com"
objCDOSYSMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
objCDOSYSMail.Configuration.Fields.Update

objCDOSYSMail.From=strFrom
objCDOSYSMail.To=strTo
objCDOSYSMail.Cc=strCc
objCDOSYSMail.Bcc=strBcc
objCDOSYSMail.Subject=strSubject
objCDOSYSMail.TextBody=strBody

objCDOSYSMail.Send

----------------------------------------------------------

What do you think?

 
Old March 22nd, 2004, 01:24 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think that Request.Form("VPEMail") and Request.Form("ReqEmail") do not contain a valid value, so you end up with an illegal e-mail address.

Do these form variables match with text box controls on your form? Is a user supposed to type these in, or are they sent through hidden form fields?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 22nd, 2004, 01:40 PM
Authorized User
 
Join Date: Mar 2004
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to stellabantug
Default

ReqEmail is a required field. The requestor needs to fill up the first part of their email address (i.e. "stella.bantug"), and the last part of the email address is provided directly through the code.

This is how the code looks like:
-------------------------------------
strFrom=Request.Form("ReqEmail")& "@advocatehealth.com"
--------------------------------------

The VPEmail is not a required field. I tried filling this in anyways, and it worked. I double checked and I'm sure this is not a required field. But this is the Cc field too.

Another thing, the email confirmation page gave me the following:
--------------------------------------------------------------
The following information was submitted:Requestor's Name: testingSite: testingRequestor's Email: [email protected]P's Email: [email protected]riority: LowResearch needed by: 03/20/2004Prospect Name: testingPast Giving: YesResearch needed for: Preliminary EvaluationProspect's Moves Management Status: IdentificationInformation you would like to obtain: testingThank you for submitting your data.
-------------------------------------------------------------

How do I put line breaks to this? Below is a part of the code that I have to create the email message:

------------------------------------------------------------

strBody="The following information was submitted:" & Chr(13) & Chr(13)

If Trim(Request.Form("Contact_FullName"))<>"" Then
   strBody = strBody & "Requestor's Name: " & Request.Form("Contact_FullName") & Chr(13)
End If

If Trim(Request.Form("Site"))<>"" Then
   strBody = strBody & "Site: " & Request.Form("Site") & Chr(13)
End If

If Trim(Request.Form("ReqEmail"))<>"" Then
   strBody = strBody & "Requestor's Email: " & Request.Form("ReqEmail") & "@advocatehealth.com" & Chr(13)
End If



THANKS IMAR!!!





 
Old March 22nd, 2004, 02:23 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, it may not be required in the database, but it is required if you code your e-mail like this. Take a look at this:

strCc=Request.Form("VPEMail") & "@advocatehealth.com"
strBcc=Request.Form("ReqEmail") & "@advocatehealth.com"

...

objCDOSYSMail.From=strFrom
objCDOSYSMail.To=strTo
objCDOSYSMail.Cc=strCc

Suppose somebody leaves VPEMail empty. What does your CC address look like tin that case? It will be just: "@advocatehealth.com" which is of course not a valid value.

You should check the Length of VPEMail before you assign it to the CC field. If it's empty, don't assign it. Otherwise, append the part after th @ to it, and assign it to the CC field.

If you are using text mail use vbCrlf for a line break, like this:

strBody = strBody & vbCrLf & "Some Other Text"

Otherwise, just embed a <br> tag if you are sending HTML mail.

If I were you, I'd go through my older posts in this thread and remove references to e-mail addresses and mail servers. Posting this kind of information on public forums is not a wise thing to do. And while you're there, can you please put some line breaks here and there in the stuff you're posting? It makes your posts much easier to read..... Or maybe you should start a new thread if another issues comes up. I am getting tired of scrolling and typing these messages in a too wide window.


Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
CDONTS and CDOSYS hamproof Classic ASP Databases 0 August 24th, 2007 01:37 PM
CDONTS to CDOSYS icis Classic ASP Basics 1 March 2nd, 2006 06:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.