Forms - Publishing to a dbase & .txt file

M

Mike

I am using ASP to submit a fom to to a MS Access dbase. I also need to have
the form send an e-mail, with a text file of the same information attached.
Is this possible? How would I do this?

Thanks.
 
J

Jim Buyens

-----Original Message-----
I am using ASP to submit a fom to to a MS Access dbase. I
also need to have the form send an e-mail, with a text
file of the same information attached.
Is this possible? How would I do this?

If you created the ASP page by using the FrontPage Save
Results to Database feature, sending mail at the same time
isn't exactly possible. (There are some curious schemes
that do this by chaining together several pages but I,
personally, steer away from them.)

If you created the ASP page by writing your own code, then
you need to write additional code that sends mail. Some
ISPs support the Microsoft-supplied CDONTS.NewMail object
for this, but many others prefer third-party mail objects.
Check your ISP's Help pages to see what they provide.

Here's a simple example using the CDONTS.NewMail object.

Set objNewMail = Server.CreateObject("CDONTS.NewMail")
objNewMail.From = "(e-mail address removed)"
objNewMail.To = "(e-mail address removed)"
objNewMail.Subject = "What am I about?"
objNewMail.Body = "The body of your message goes here."
objNewMail.Send
Set objNewMail = Nothing

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
M

Mike

Jim,

Thanks for the code. I put it on my confirmation page and submitted it.
I got the following error:

Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'objCDOMail'

/test/form_confirmation_new.asp, line 1225

Line 1225 is: Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
Any seguestions? I have my own W2K server that I am using. How can I check
to see if CDONTS is installed and working?

Thanks,

Mike
 
T

Thomas A. Rowe

Install the SMTP server or make sure it is running.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
J

Jim Buyens

Mike said:
Jim,

Thanks for the code. I put it on my confirmation page and submitted it.
I got the following error:

Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'objCDOMail'

/test/form_confirmation_new.asp, line 1225

Line 1225 is: Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
Any seguestions? I have my own W2K server that I am using. How can I check
to see if CDONTS is installed and working?

The phrase "confirmation page" worries me. If this means you set up a
form and then used FrontPage dialog boxes to configure it Where To
Store Results: Save To Database, well, that's the case I already told
you wouldn't work.

If you wrote your own ASP code to build an INSERT statement and
execute it using an ADO command object, or if you opened an ADO
recordset, created a new record, filled it with data, and then saved
it, *that's* the scenario where the code I posted would be useful.

The message Variable is undefined: 'objCDOMail' means that you need to
add a
Dim objCDOMail
statement somewhere before
Set objNewMail = Server.CreateObject("CDONTS.NewMail")

If creating the Server.CreateObject fails, that indicates that the
CDONTS.NewMail class isn't installed. If the Send method fails or the
mail never arrives, that probably indicates a configuration failure.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top