form to mail newbie

A

Auddog

First thanks for any help that you might be able to provide.

I've written a very small web form that I want to have emailed to me when a
user clicks submit. I have researched on the interent, but I'm not sure now
that it as easy as I first thought as most talk about remote servers. I
have a windows 2000 server sp4 running exchange 2000 that also is my
webserver IIS 5.

I know this is simply enough, I'm just need some direction to get started.

Thanks

A
 
R

Ray Costanzo [MVP]

You should be able to do/start with something as simple as this:

<%
Dim oCDO
Set oCDO = CreateObject("CDO.Message")
oCDO.From = "your@yourdomain"
oCDO.To = "you@yourdomain"
oCDO.Subject = "Form results test"
oCDO.TextBody = "Value of form field is " & Request.Form("nameOfFormField")
oCDO.Send
Set oCDO = Nothing
%>

See here for more details:
http://www.aspfaq.com/show.asp?id=2026

Ray at work
 
A

Auddog

Ray,

Thanks for the quick reply. Greatly appreciated.

I do have one question. I'm testing this on my desktop running windows xp
with sp2, if I remember right that is also IIS 5.1 and I do have the smtp
service running. When I run the web form here is the error that I get:

Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'From'
/company/report_problem.asp, line 9


Here is my code:

<%
DIM strFirstName, strLastName, strComments
strFirstName = request.form("fname")
strLastName = request.form("lname")
strComments = request.form("description")

DIM oCDO, strMsgHeader
Set oCDO = CreateObject("CDO.Message")
oCDO.From "(e-mail address removed)"
oCDO.To (e-mail address removed)
oCDO.Subject = "Problems"
strMsgHeader = "This email was delivered from the intranet website." &
vbCrLf & vbCrLf
oCDO.Body = strMsgHeader & "First Name: " & strFirstName & vbCrLf & _
"Last Name: " & strLastName & vbCrLf & _
"Description: " & vbCrLf & strComments
oCDO.Send
Set oCDO = Nothing
%>

<P>
<%
Response.Write strFirstName & ",<br>"
Response.Write "Your message has been successfully sent."
%>,</P>

Thanks again Ray


A
 
A

Auddog

Okay Ray, I found that error and here is my code for this page. But now I
get a different error which I have pasted below my page code. Thanks again
for looking over this code.

<%
DIM strFirstName, strLastName, strComments
strFirstName = request.form("fname")
strLastName = request.form("lname")
strComments = request.form("description")

DIM oCDO, strMsgHeader
Set oCDO = CreateObject("CDO.Message")
oCDO.From ="(e-mail address removed)"
oCDO.To = "(e-mail address removed)"
oCDO.Subject = "Problems"
strMsgHeader = "This email was delivered from the intranet website." &
vbCrLf & vbCrLf
oCDO.TextBody = strMsgHeader & "First Name: " & strFirstName & vbCrLf & _
"Last Name: " & strLastName & vbCrLf & _
"Description: " & vbCrLf & strComments
oCDO.Send
Set oCDO = Nothing
%>

<P>
<%
Response.Write strFirstName & ",<br>"
Response.Write "Your message has been successfully sent."
%>,</P>



Error Type:
CDO.Message.1 (0x80040220)
The "SendUsing" configuration value is invalid.
/company/report_problem.asp, line 17

Let me know if you need anything else.

A
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top