Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Form to E-mail?

Posted 01 Nov 2004 15:20:46
1
has voted
01 Nov 2004 15:20:46 Richard Wood posted:
I relativeley new to web design and i need to know is it possible on my own fairly small site, to send the contents of a form, to my own e-mail. Its just a stamdard form with first name, second name, phone, email, and message. Is there a way of doing it just using javascript, because i know nothing of CGI's Perl Asp's or anything like that. Oh and i dont have access to a database

Replies

Replied 02 Nov 2004 01:17:35
02 Nov 2004 01:17:35 Seb Adlington replied:
If you're not bothered about formatting use the basice code as below

<form name="form1" method="post" action="mailto: " enctype="text/plain">
<input name="Name" type="text" id="Name">
<input name="email" type="text" id="email">
<input type="submit" name="Submit" value="Submit">
</form>

if you want anything that produces nicer looking mails you'll need to look into somehting like CDONTS

hope that helps
Replied 02 Nov 2004 11:27:02
02 Nov 2004 11:27:02 Ivo Hunink replied:
I agree with Seb Adlington, You can use the CDONTS object
which is very usefull for sending mail.

Little Example Code:
<pre id=code><font face=courier size=2 id=code>
Dim objCDOMail
Set objCDOMail = Server.CreateObject("CDONTS.NewMail"
objCDOMail.To = " "
objCDOMail.From = "/ "
objCDOMail.Subject = "goodMorning"
objCDOMail.Body = "blablablablablablablablablablablabla"
objCDOMail.Send
</font id=code></pre id=code>

This object is not standard in each IIS server, look at google for how to install it.

=)
Replied 02 Nov 2004 14:50:30
02 Nov 2004 14:50:30 Richard Wood replied:
Thank you very much guys, that helps alot. Ill be sure to look into the cdonts.
Replied 05 Nov 2004 00:45:49
05 Nov 2004 00:45:49 A. M. replied:
Check the server you are using first--Windows 2003 Server dropped CDONTS and instead uses CDOSYS--it's not much different to use but there are some changes. Of course if you have the CDONTS dll from a 2000 server you can place it in the same directory where the CDOSYS dll is and then you can use either of them.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Thank you very much guys, that helps alot. Ill be sure to look into the cdonts.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Replied 05 Nov 2004 02:33:14
05 Nov 2004 02:33:14 Seb Adlington replied:
The guys who do our hosting upgraded all ther systems to Win 2003 last month - all my sites use CDONTS to some extent - is it worth changing the scripts to use this CDOSYS.

Is it that much better?
Replied 05 Nov 2004 16:28:28
05 Nov 2004 16:28:28 A. M. replied:
I don't think it's better or worse, just different. You'll have to check and see if you can still run CDONTS on Win 2003. When our systems upgraded from 2000 to 2003 we found that CDONTS was no longer part of the operating system--CDOSYS is microsoft's replacement for CDONTS and is standard with 2003 OS--microsoft claims it's better but I haven't noticed any changes in performance. Rather than copying the CDONTS.dll to our new operating system so it could run, we opted for changing all instances where we used CDONTS to CDOSYS--a few changes in the coding, but most of it is exactly the same.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
The guys who do our hosting upgraded all ther systems to Win 2003 last month - all my sites use CDONTS to some extent - is it worth changing the scripts to use this CDOSYS.

Is it that much better?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Replied 05 Nov 2004 17:59:07
05 Nov 2004 17:59:07 Seb Adlington replied:

I guess our server guys must have copied the CDONTS.dll onto the new systems, coz all our scripts still work ok. Can't see any point in changing them after what you say.

Cheers for that.
Replied 10 Nov 2004 16:56:40
10 Nov 2004 16:56:40 Richard Wood replied:
Thank you for all your help guys but, if you go to www.tempestdesignworks.com, and click thru to co0ntact youll see that when the form is submitted it opens the e-mail browser and the viewer can see what is being sent. is there any way that i can get the sam efunctionality but with out the user ever seing the sent data? or even the emai program?
Replied 11 Nov 2004 11:42:02
11 Nov 2004 11:42:02 Seb Adlington replied:
You would probaby be best off trying the CDONTS/CDOSYS as mentioned here's a quick fix for you

Create a new page called thanks.asp, copy the code below to it - it is set up to work with your form.
Then on your contact page, change the form to point to thanks.asp i.e

&lt;form name="form1" method="post" action="thanks.asp"&gt;

If you do get any problems, you need to check if your server supports CDONTS or CDOSYS

Enjoy


----------------------Copy Page ------------------------------
&lt;%@LANGUAGE="VBSCRIPT" %&gt;
&lt;%
'///////////////// send cdo email.

'content of the email
mailbody= "&lt;font size=2 face=verdana&gt;"
mailbody=mailbody & Replace(Request.Form("message", vbCrLf, "&lt;br /&gt;" & "&lt;br&gt;" & "&lt;br&gt;"
mailbody=mailbody & "&lt;strong&gt;" & "FirstName: " & "&lt;/strong&gt;" & Request.Form("firstname" & "&lt;br&gt;"
mailbody=mailbody & "&lt;strong&gt;" & "Lastname: " & "&lt;/strong&gt;" & Request.Form("lastname" & "&lt;br&gt;"
mailbody=mailbody & "&lt;strong&gt;" & "Telephone: " & "&lt;/strong&gt;" & Request.Form("phonenumber" & "&lt;br&gt;"
mailbody=mailbody & "&lt;strong&gt;" & "Email: " & "&lt;/strong&gt;" & Request.Form("email" & "&lt;br&gt;"
mailbody=mailbody & "&lt;strong&gt;" & "Contact me by: " & "&lt;/strong&gt;" & Request.Form("radiobutton" & "&lt;br&gt;" & "&lt;BR&gt;"
mailbody=mailbody & "&lt;strong&gt;" & "Address: " & "&lt;/strong&gt;" &
mailbody=mailbody & "Sent at " & Now()

'variables to send the email
Set objCDO = Server.CreateObject("Cdonts.NewMail"
objCDO.BodyFormat =0 ' 0 is a plain text, 0 "zero" is a HTML
objCDO.MailFormat = 0 ' 1 is a plain text, 0 "zero" is mime format
objCDO.To = "xxxx@xxxxxx" ' put your email address here
objCDO.From = Request.Form("email"
objCDO.Subject ="Enquiry from the Tempest Website"
objCDO.Body =mailbody
objCDO.Send
Set objCDO = Nothing

'///////////////// send cdo email. end

%&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Thankyou Page &lt;/title&gt;

&lt;/head&gt;

&lt;body bgcolor="#FFFFFF" &gt;

Thankyou, your email has been sent

&lt;/body&gt;
&lt;/html&gt;

Reply to this topic