D
Dave ADM
I have an asp page form successfully putting form data into an Access
database. I also need the form data to be sent in the body of an email to
multiple email addresses. In a previous thread I was advised to use the CDO
mail component as outlined in this link:
http://www.interlacken.com/winnt/tips/tipshow.aspx?tip=46
My host has CDO on the server.
I have included what I think is the correct script in the header (not the
body) of the asp form page - I am not an ASP programmer though, so I may have
made a mistake or two. However, when I run the page now the data is still
getting into the database, but I'm not getting any emails sent.
The host uses smtp authentication.
You can see the test form at www.unsecured-direct-loans.co.uk.
The code I have included in the header reads as follows:
<%
Const cdoSchema = "http://schemas.microsoft.com/cdo/configuration/"
If request("btnSub") <> "" Then
Set objMsg = CreateObject("CDO.Message")
objMsg.Subject = "Test Form Enquiry" & now()
objMsg.Sender = "(e-mail address removed)"
objMsg.To = "(e-mail address removed)"
objMsg.TextBody = _
"The Name field contained: " & request("Contact_FullName") & vbCrLf & _
"The Title field contained: " & request("Contact_Title") & vbCrLf & _
"The Organisation field contained: " & request("Contact_Organization") &
vbCrLf & _
"The Work Phone field contained: " & request("Contact_WorkPhone") & vbCrLf
& _
"The FAX field contained: " & request("Contact_FAX") & vbCrLf & _
"The Email field contained: " & request("Contact_Email") & vbCrLf & _
"The URL field contained: " & request("Contact_URL") & vbCrLf
objMsg.Configuration.Fields.Item(cdoSchema & "sendusing") = 2
objMsg.Configuration.Fields.Item(cdoSchema & "smtpserver") =
"auth.smtp.1and1.co.uk"
objMsg.Configuration.Fields.Item(cdoSchema & "smtpserverport") = 587
objMsg.Configuration.Fields.Item(cdoSchema & "smtpauthenticate") = 1
objMsg.Configuration.Fields.Item(cdoSchema & "sendusername") = "YYYYYY"
objMsg.Configuration.Fields.Item(cdoSchema & "sendpassword") = "ZZZZZZ"
objMsg.Configuration.Fields.Update
objMsg.Send
Response.Write "<p>Message sent.</p>" & vbCrLf
End If
%>
I'd really appreciate some help in understanding why this element isn't
working yet.
Is it due to:
1. Incorrect code/scripting?
2. Positioning of the script - header versus body?
3. A critical setting that is wrong?
4. Is the code not being "triggered" properly at the moment the person hits
the "submit" button to send the data to the database?
5. Other factor
or indeed a combination of various things above?
Thanks in advance for any help you can give me.
Dave (FP / ASP newbie)
database. I also need the form data to be sent in the body of an email to
multiple email addresses. In a previous thread I was advised to use the CDO
mail component as outlined in this link:
http://www.interlacken.com/winnt/tips/tipshow.aspx?tip=46
My host has CDO on the server.
I have included what I think is the correct script in the header (not the
body) of the asp form page - I am not an ASP programmer though, so I may have
made a mistake or two. However, when I run the page now the data is still
getting into the database, but I'm not getting any emails sent.
The host uses smtp authentication.
You can see the test form at www.unsecured-direct-loans.co.uk.
The code I have included in the header reads as follows:
<%
Const cdoSchema = "http://schemas.microsoft.com/cdo/configuration/"
If request("btnSub") <> "" Then
Set objMsg = CreateObject("CDO.Message")
objMsg.Subject = "Test Form Enquiry" & now()
objMsg.Sender = "(e-mail address removed)"
objMsg.To = "(e-mail address removed)"
objMsg.TextBody = _
"The Name field contained: " & request("Contact_FullName") & vbCrLf & _
"The Title field contained: " & request("Contact_Title") & vbCrLf & _
"The Organisation field contained: " & request("Contact_Organization") &
vbCrLf & _
"The Work Phone field contained: " & request("Contact_WorkPhone") & vbCrLf
& _
"The FAX field contained: " & request("Contact_FAX") & vbCrLf & _
"The Email field contained: " & request("Contact_Email") & vbCrLf & _
"The URL field contained: " & request("Contact_URL") & vbCrLf
objMsg.Configuration.Fields.Item(cdoSchema & "sendusing") = 2
objMsg.Configuration.Fields.Item(cdoSchema & "smtpserver") =
"auth.smtp.1and1.co.uk"
objMsg.Configuration.Fields.Item(cdoSchema & "smtpserverport") = 587
objMsg.Configuration.Fields.Item(cdoSchema & "smtpauthenticate") = 1
objMsg.Configuration.Fields.Item(cdoSchema & "sendusername") = "YYYYYY"
objMsg.Configuration.Fields.Item(cdoSchema & "sendpassword") = "ZZZZZZ"
objMsg.Configuration.Fields.Update
objMsg.Send
Response.Write "<p>Message sent.</p>" & vbCrLf
End If
%>
I'd really appreciate some help in understanding why this element isn't
working yet.
Is it due to:
1. Incorrect code/scripting?
2. Positioning of the script - header versus body?
3. A critical setting that is wrong?
4. Is the code not being "triggered" properly at the moment the person hits
the "submit" button to send the data to the database?
5. Other factor
or indeed a combination of various things above?
Thanks in advance for any help you can give me.
Dave (FP / ASP newbie)