473,770 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with asp website form

I'm used to unix/cgi scripts so im slightly out of my depth here.
Ive got an asp script for a website form which works fine.
What i want to do is also get the form to include the ip address of the
perosn sending the form ie
<input type=hidden name=env_report value=REMOTE_AD DR>
Anyone know how to apply this to this asp script below?:

<%
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set MailObject = Server.CreateOb ject("CDONTS.Ne wMail")
MailObject.From = "we*****@xxx.co m"
MailObject.To = "we*****@xxx.co m"
MailObject.Subj ect = "Form"
MailObject.Body = sBody & vbCrLf

MailObject.Send
Set MailObject = Nothing
' Now redirect
Response.Redire ct "http://www.xxx/thank_you.htm"
%>
Jul 19 '05
44 3262
Changing from CDONTS to CDO isn't really hard. You could probably actually
do it with a find/replace in a text editor, for the most part. But
something else to consider is to create a sub or a function to handle
e-mailing and use that in your code, so that if you have to change mail
components, you just change the code in your sub.
Sub SendAnEmail(sFr om, sTo, sSubject, sBody)
Set oMail = CreateObject("Y ourMailComponen t")
'''code to send e-mail

End Sub
Then anywhere in your ASP code where you need to send e-mail, just call the
sub and pass the arguments. You'd want to put this sub in an include file
so you can use it in any page.

Ray at home
"Mike" <me@privacy.net > wrote in message
news:10******** ********@eunomi a.uk.clara.net. ..

Also, instead of CDONTS, you should be using CDO, unless you're on an NT 4 server. CDONTS is being phased out.
http://www.aspfaq.com/show.asp?id=2026

Ray at home

Is this likely to be phased out soon?
FYI: The host is www.hostmysite.com

As i said i know nothing about asp / CDONTS / CDO.

currently i am using the above script with a form action of:

<form name="form" method="post" action="http://www.xxx.com/form.asp">

Is there a simple way to alter the current script to CDO or am i going to
have to look for somehting new?

Your advice is appreciated

Jul 19 '05 #11

"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Changing from CDONTS to CDO isn't really hard. You could probably actually do it with a find/replace in a text editor, for the most part. But
something else to consider is to create a sub or a function to handle
e-mailing and use that in your code, so that if you have to change mail
components, you just change the code in your sub.
Sub SendAnEmail(sFr om, sTo, sSubject, sBody)
Set oMail = CreateObject("Y ourMailComponen t")
'''code to send e-mail

End Sub
Then anywhere in your ASP code where you need to send e-mail, just call the sub and pass the arguments. You'd want to put this sub in an include file
so you can use it in any page.

Ray at home

not sure im with you on the changes.

Does anyone have a basic default cdo asp file script knocking about that
simply sends the form contents
and provides a redirect page.

Im simply looking for an asp which can be called via:

<form name="form" method="post" action="http://www.xxx.com/form.asp">

whch then submits to email. i think it would be wise if i find a CDO one
now rather than later.

cgi/unix scripts are 10 a penny but asp ones seem more difficult to find


Jul 19 '05 #12
Mail with CDO:
http://www.darkfalz.com/1090

Otherwise look at www.aspfaq.com

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Mike" <me@privacy.net > wrote in message
news:10******** ********@nnrp-t71-03.news.uk.clar a.net...

"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
Changing from CDONTS to CDO isn't really hard. You could probably

actually
do it with a find/replace in a text editor, for the most part. But
something else to consider is to create a sub or a function to handle
e-mailing and use that in your code, so that if you have to change mail
components, you just change the code in your sub.
Sub SendAnEmail(sFr om, sTo, sSubject, sBody)
Set oMail = CreateObject("Y ourMailComponen t")
'''code to send e-mail

End Sub
Then anywhere in your ASP code where you need to send e-mail, just call

the
sub and pass the arguments. You'd want to put this sub in an include file so you can use it in any page.

Ray at home

not sure im with you on the changes.

Does anyone have a basic default cdo asp file script knocking about that
simply sends the form contents
and provides a redirect page.

Im simply looking for an asp which can be called via:

<form name="form" method="post" action="http://www.xxx.com/form.asp">

whch then submits to email. i think it would be wise if i find a CDO one
now rather than later.

cgi/unix scripts are 10 a penny but asp ones seem more difficult to find

Jul 19 '05 #13

"Mike" <me@privacy.net > wrote in message
news:10******** ********@nnrp-t71-03.news.uk.clar a.net...

not sure im with you on the changes.
That's okay. One step at a time.
Does anyone have a basic default cdo asp file script knocking about that
simply sends the form contents
and provides a redirect page.
I posted a decent link in my first reply yesterday. Did you check out the
page? Here's the link again.
http://www.aspfaq.com/show.asp?id=2026
i think it would be wise if i find a CDO one
now rather than later.
I commend you for that attitude. Most people would say the Hell with it and
make things harder for themselves later on. Good job. :]

cgi/unix scripts are 10 a penny but asp ones seem more difficult to find


If you have not already done so, bookmark http://www.darkfalz.com/ and the
the sites found at http://www.darkfalz.com/Links.aspx.

Ray at work
Jul 19 '05 #14

Ok this basic cdo script seems to dot he trick.

<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("C DO.Message")
iMsg.To = "So*****@SomeSi te.com"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <me@ThisSite.co m>"
iMsg.TextBody = "This is the body of the message"
iMsg.Send
%>
The problem is how i go about adding the following elements:

1) Getting the form to submit the contents of all form fields.
Obviously currently all it submits is the text body message: "This is the
body of the message"

2) Specifying a redirect url
Response.Redire ct "http://www.xxx.com/thank_you.htm"

3) Adding the ip address of the form sender ie:
sBody = sBody & "IP Address: " & Request.ServerV ariables("REMOT E_ADDR")
Any help in correctly adding the above to the script would be appreciated

Jul 19 '05 #15

"Mike" <me@privacy.net > wrote in message
news:10******** ********@dyke.u k.clara.net...

Ok this basic cdo script seems to dot he trick.

<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("C DO.Message")
iMsg.To = "So*****@SomeSi te.com"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <me@ThisSite.co m>"
iMsg.TextBody = "This is the body of the message"
iMsg.Send
%>
The problem is how i go about adding the following elements:

1) Getting the form to submit the contents of all form fields.
Obviously currently all it submits is the text body message: "This is the
body of the message"
Remember in your original post you had that For Each x in request.form
line...? You can still use that variable in place of the text string that's
currently set as the .textbody.

2) Specifying a redirect url
Response.Redire ct "http://www.xxx.com/thank_you.htm"
Use that exact line that you have there. (Or just response.redire ct
"/thankyou.htm" if this is all taking place on your site.)

3) Adding the ip address of the form sender ie:
sBody = sBody & "IP Address: " & Request.ServerV ariables("REMOT E_ADDR")


As covered in the original reply. I think now it's just a matter of piecing
it all together.

Ray at work
Jul 19 '05 #16

"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:us******** ******@TK2MSFTN GP09.phx.gbl...

"Mike" <me@privacy.net > wrote in message
news:10******** ********@dyke.u k.clara.net...

Ok this basic cdo script seems to dot he trick.

<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("C DO.Message")
iMsg.To = "So*****@SomeSi te.com"
iMsg.Subject = "This is the Subject"
iMsg.From = "Me <me@ThisSite.co m>"
iMsg.TextBody = "This is the body of the message"
iMsg.Send
%>
The problem is how i go about adding the following elements:

1) Getting the form to submit the contents of all form fields.
Obviously currently all it submits is the text body message: "This is the body of the message"
Remember in your original post you had that For Each x in request.form
line...? You can still use that variable in place of the text string

that's currently set as the .textbody.

2) Specifying a redirect url
Response.Redire ct "http://www.xxx.com/thank_you.htm"
Use that exact line that you have there. (Or just response.redire ct
"/thankyou.htm" if this is all taking place on your site.)

3) Adding the ip address of the form sender ie:
sBody = sBody & "IP Address: " & Request.ServerV ariables("REMOT E_ADDR")


As covered in the original reply. I think now it's just a matter of

piecing it all together.

Ray at work

Hi
sry not sure i was clear, i tried to create the right script but because
i'm not familar with asp i can't find the errors.
perhaps easier if i post what i have (see below). can you tell me whats
wrong?
<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("C DO.Message")
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf

iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/thank_you.htm"
%>
Jul 19 '05 #17
You didn't close your For loop.

<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set iMsg = CreateObject("C DO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/thank_you.htm"
%>

Ray at work
Hi
sry not sure i was clear, i tried to create the right script but because
i'm not familar with asp i can't find the errors.
perhaps easier if i post what i have (see below). can you tell me whats
wrong?
<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("C DO.Message")
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf

iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/thank_you.htm"
%>

Jul 19 '05 #18
I did not look closely enough. There's no .body or .sbody thing. You had
the right property in there before. .TextBody.

Ray at work

"Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
news:ut******** ******@TK2MSFTN GP11.phx.gbl...
You didn't close your For loop.

<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next
Set iMsg = CreateObject("C DO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/thank_you.htm"
%>

Ray at work
Hi
sry not sure i was clear, i tried to create the right script but because i'm not familar with asp i can't find the errors.
perhaps easier if i post what i have (see below). can you tell me whats
wrong?
<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
Set iMsg = CreateObject("C DO.Message")
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf

iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.Body = sBody & vbCrLf
iMsg.sBody = sBody & "IP Address: " &
Request.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/thank_you.htm"
%>


Jul 19 '05 #19
I must be close! grrr.
Any pointers what is wrong?
<%@ Language=VBScri pt %>
<%
Option Explicit
Dim iMsg
For Each x in request.form
sBody = sBody & x & " = " & request.form(x) & vbCrLf
Next

Set iMsg = CreateObject("C DO.Message")
iMsg.To = mi**@xxx.com
iMsg.Subject = "This is the Subject"
iMsg.From = "Me mi**@xxx.com"
iMsg.TextBody = "This is the body of the message"
Request.ServerV ariables("REMOT E_ADDR")

iMsg.Send
Response.Redire ct "/thank_you.htm"
%>
Jul 19 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3271
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old scripts working on a new server with the most recent version of PHP. I've pretty much taken care of all the various errors that were popping up. Most only pointed out out non-fatal undefined or assumed variables. I've been able to cure most of...
2
5224
by: Mindful_Spirit | last post by:
I'm trying to set up a basic email feed back form like this, and was wondering about some basic configuration settings. I have used code from this website. I have it working just fine. I'm running IIS on my home machine. My problem is that I need to upload this stuff to a webhosting place and register a domain and I'm not sure what to put as the smtp mail server value
1
1663
by: Roel | last post by:
Hello, I have a simple script that will reload http://website/CAM1picture.jpg every xx minutes. I'm trying to add a form <input type="submit" value="CAM1" name="B1"><input type="submit" value="CAM2" name="B1"> So when I click on CAM2 button it will reload http://website/CAM2picture.jpg and when I click on CAM3 button it will reload http://website/CAM3picture.jpg and so on. I appreciate if someone can show me how to do it. Here's a...
17
2087
by: freemann | last post by:
Can anyone provide example code showing how to send form results to a results page, email and a comma delimited file? Notice that I need it going to all three locations. Details: I have forms created and working. The first form the user fills out and submits. The form properties are set to Send to other: "Custom ISAPI, NSAPI, CGI, OR ASP SCRIPTING. The method is "POST" and the action is "secondpage.asp". I had to go this route because...
23
2803
by: casper christensen | last post by:
Hi I run a directory, where programs are listed based on the number of clicks they have recieved. The program with most clicks are placed on top and so on. Now I would like people to be apple to place a link on there site so people can vote for their program, "ad a click". eg someone clicks the link on some page and it counts +1 click on my page. if some one clicks the link below it will count a click on my page.
12
2241
by: liamo | last post by:
Don't laugh lol I know your all php guru's : ) Ok, so I have little if any knowledge with the programming language php - only having created small enquiry forms. Now I have a client that needs a job order form with a little more function than having solely contact details and a big enquiry text area. The form I created in HTML is located at http://www.ebesign.co.nz/projects/justfixit/job_order_form.html and has used javascript to...
3
1810
by: Porkie999 | last post by:
-----------------------------------------------------------------------QUESTION hi i am really stuck with this and its only a small problem. i want to be able to type ......... dsfsjfjsjjfs in User Box fjdjskfjds in password box www.thescripts.com in website box then i want to have a button which says "save" which then saves the 3 above pieces of text into a notepad file. So like I said I want to be able to type a login, password and...
2
1542
by: Comcast | last post by:
I am using a form that uses PHP to create an e-mail and send it off. When the script runs, I get an error page, although the e-mail is sent off. The error I am getting is: Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/website/html/contact/scformproc.php:1) in /home/content/website/html/contact/scformproc.php on line 51 ? Warning: Cannot modify header information -...
4
1565
by: Twisted01 | last post by:
Hello, I am new here and I hope I have the correct forum to answer my question. I am creating a website for a friend and they need a "Search Form" so that visitors can search for items on the website rather than searching the entire website to find what they are looking for. I know about my HTML/XHTML and CSS coding and the basic coding for a Search Form. What I need is help with any other files needed to make my Form a workable Search Form so...
70
5403
mideastgirl
by: mideastgirl | last post by:
I have recently been working on a website for an honors association, and have a lot of difficulty but have found help from those on this site. I would like to see if I can get some more help on a different issue than what I was initially having. I am working on storing data collected from a form on my website. I would like the information to be stored into MySQL once entered by users. I have googled this question and have tried multiple...
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.