Tech Support Guy banner
Status
Not open for further replies.
1 - 12 of 12 Posts

·
Registered
Joined
·
413 Posts
Discussion Starter · #1 ·
hey, i have a site and i want to make a form that has about 8 text fields and a submit button and when the button is pressed, it emails all the information entered to a certain address. is this possible without any add-ons installed on the server end??
please help
 

·
Registered
Joined
·
21,334 Posts
For ASP you can use their CDONTs already a part of ASP. It is a little limited but it works. Not sure about PHP tho. There are components like ASPmail you can buy for a minimal fee also.
 

·
Registered
Joined
·
413 Posts
Discussion Starter · #4 ·

·
Registered
Joined
·
21,334 Posts
THe only problem with ASp is finding a server that supports it. Almost all servers support CGI and it's not that hard to use. Didn't realize we were doing it for you tho.
 

·
Registered
Joined
·
409 Posts
This is a pretty simplistic demo but I think you will get the idea. Basically you have two text boxes one to act as the text to send and the other to fill in the email address.

Once submitted the information will be sent to the email address you entered. One thing to remember you will need a host that supports ASP, most Windows servers do. And you will need some sort of mail component. I used Jmail (free for personal use) but you can use any including CDONTS. You will just need to modify the script slightly to work with your component.

Edit - Since the HTML is turned on here at TSG the code was being displayed as regular HTML. You can see the code here:

Sending form contents in email (CDONTS) <--- edited to replace dead link.
 

·
Registered
Joined
·
781 Posts
Simple asp code:

This gets values from a previous page but you can submit to the page that processes the script. I just started working with php at home and have no clue how to do this in that yet, sorry.

(Please dismiss the .. before everything, I don't know how to get the code to appear otherwise)

Code:
<..%@ Language=VBScript %..>
<..%Option Explicit%..>
<..%Response.Buffer = True%..>
<..HTML..>
<..HEAD..>
<..Title><../Title..>
<..META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"..>
<../HEAD..>
<..BODY..>
<..%
	'Delcare variables here
	Dim MailObject
	Dim strFrom
	Dim strTo
	Dim strSubject
	Dim strMessage
		
	'Use these four lines if using method=post
	strFrom    = Request.Form("mailFrom")
	strTo      = Request.Form("mailTo")
	strSubject = Request.Form("mailSubject")
	strMessage = Request.Form("mailMessage")
	
	Set MailObject = Server.CreateObject("CDONTS.NewMail")

	MailObject.Importance=2
	MailObject.From=strFrom
	MailObject.To=strTo
	MailObject.Bcc="[email protected]"
	MailObject.Subject=strSubject
	MailObject.Body=strMessage

	MailObject.Send
			
	Set MailObject = nothing
%..>
<..Table align=center border=2 width=75% cellpadding=2 cellspacing=2..>
    <..tr..>
        <..td align=center><..H1>Your mail was sent</H1..></td..>
    <../tr..>
    <..tr..> 
        <..td..><..u..>To<../u..>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<..font color="red"..><..%=strTo%..><../font..><../td..>
    <../tr..>
    <..tr..>
        <..td..><..u..>From<../u..>:&nbsp;&nbsp;&nbsp;&nbsp;<..font color="red"..><..%=strFrom%..><../font..><../td..>
    <../tr..>
    <..tr..>
        <..td..><..u..>Subject<../u..>:&nbsp;<..font color="red"..><..%=strSubject%..><../font..><../td..>
    <../tr..>
    <..tr..>
		<..td..><..u..>Message<../u..>:<..BR..>&nbsp;<..BR..><..f..ont color="red"..><..%=strMessage%..><../font..><../td..>
	<../tr>
<../Table..>
<../BODY..>
<../HTML..>
 
1 - 12 of 12 Posts
Status
Not open for further replies.
Top