Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am a Looser or Winner?

Status
Not open for further replies.

Lesiba5

IS-IT--Management
Sep 19, 2003
5
ZA
I have explained it before that I don't know PHP, Perl or CGI. And so I have designed a Form
that I want it to send Mail when someone click submit, The is no back end Database because I don't
want the Information to be stored in the Database. I want the information to be send straight to the Email

I am just using ASP, VBScript and JavaScript only and the is no language that is been installed in my
computer like Perl, CGI and PHP.

If you are using PHP, Perl or CGI please try to be specific because I don't know this Languages.
Can someone help if my code are not corect.

Here is my Form and Script: Form.html and Sent.asp

<Form Name=&quot;register&quot; method=&quot;get&quot; action=&quot;sent.asp&quot;>
FirstName
LastName
DOB
Email
cell
Course
</form>

Here is my Script. sent.asp

<%

Dim FirstName
FirstName = Request(&quot;FirstName&quot;)

Dim LastName
LastName = Request(&quot;Last_Name&quot;)

Dim DOB
DOB = Request(&quot;DOB&quot;)

Dim Email
Email = Request(&quot;Email&quot;)

Dim Cell
Cell = Request(&quot;Cell&quot;)

Dim Course
Course = Request(&quot;Course&quot;)

dim objCDO
Set objCDO = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

objCDO.To = liefer@123465.com '(variable we stored the user's email in)
objCDO.From = &quot;someaddy@me.com&quot;
objCDO.Subject = &quot;Registration Confirmation&quot;
objCDO.Body = &quot;&quot;

%>
<p>Thank you for registrering</p>


If you know PHP, CGI or Perl please send me better code that will work for me.
 
This example uses javascript only, but it will give
you an idea how &quot;window.location = mailto:&quot; works.

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<html>
<head>
<title>Send Email Form</title>
<script language=&quot;JavaScript&quot;>
var nwln = escape(&quot;\n&quot;);
var body_str = &quot;&quot;;
var to = &quot;you@your_site.com&quot;;
var subj = &quot;Your Form to Mail&quot;;
function nw_mail() {
d = document.email;
body_str = body_str + d.LastName.value +nwln;
body_str = body_str + d.DOB.value +nwln;
body_str = body_str + d.Email.value +nwln;
window.location = &quot;mailto:&quot; +to+ &quot;?subject=&quot; +subj+
&quot;&body=&quot; +body_str;
}
</script>
</head>
<body>
<form name=&quot;email&quot;>
Last Name:<br>
<input type=&quot;text&quot; name=&quot;LastName&quot; size=&quot;20&quot;><br>
DOB:<br>
<input type=&quot;text&quot; name=&quot;DOB&quot; size=&quot;10&quot;><br>
Email:<br>
<input type=&quot;text&quot; name=&quot;Email&quot; size=&quot;30&quot;><br>
<input type=&quot;button&quot; value=&quot;Create Email&quot; onClick=&quot;nw_mail();&quot;>

</body>
</html>

2b||!2b
 
Lesiba,

In your ASP Code, if you put this last line at the bottom of your code, it will send the email:

objCDO.send

Hope this helps,

G.




GT Interactive
-----------------------------
Components/Tools/Forums/Software/Web Services
 
Does this help:

&quot;How do I e-mail the contents of a form -- without server-side help?&quot;
faq215-3358

Cheers,


[monkey] Edward [monkey]

&quot;Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!&quot; -- inventor of the cat door
 
Gorkem is right. Check out this function:

---------------------------------------------------------
Function SendMail(pstrFrom, pstrTo, pstrSubject, pstrBody)
Dim objCDOMail 'The CDO object 'Declare the Mail Object

Set objCDOMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;) 'Create an instance of the Mail Object

objCDOMail.From = pstrFrom
objCDOMail.To = pstrTo
objCDOMail.Subject = pstrSubject
objCDOMail.Body = pstrBody

' Use HTML format
objCDOMail.BodyFormat = 0
objCDOMail.MailFormat = 0

' Send the message
objCDOMail.Send 'Send the message
Set objCDOMail = Nothing 'Clear the object to release it

SendMail = 1

End Function ' end of SendMail
----------------------------------
Thanks,
melon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top