Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1751
Number of posts: 4473

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
HELP.......Could anyone correct me mistake.......NEED HELP Posted by airwinx on 24 Nov 2003 at 3:27 PM
Hi

Cold someone tell me what's go wrong with this code:

this file name is "form.htm"

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form method="post" action="somescript.asp">
  <input type="hidden" name="Postback" value="true">
  Your Name: <input type="text" name="txtName"><br>
  Your E-Mail: <input type="text" name="txtEmail"><br>
  Your Message: <textarea name="txtMessage" rows="5" cols="80"></textarea><br>
  <input type="submit" name="submit" value="Send Email">
</form>
</body>
</html>

This file name is somescript.asp
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<head>
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
</head>

<body>
<%
  ' Check if it's a postback.  This is only really useful if you
  ' have the form submit to itself (since you only want to send
  ' the email when the user hits submit, not when the page first loads
  if (Request.Form("Postback") = "true") then
    set objEmail = Server.CreateObject("CDONTS.NewMail")
    objEmail.To = "airwinx@yahoo.com.sg"
    objEmail.From = Request.Form("txtEmail")
    objEmail.Body = "Message From " & Request.Form("txtName") & ": " & Request.Form("txtMessage")
    objEmail.Send
    set objEmail = nothing
  end if
%>
</body>
</html>


My plan for this code is to let user type in some info at "form.htm" and press the submit butn, once press, it will sent the info to my email.

The above sample code was provided by one of the member in programheavens. I had use this code for testing purpose. But the problem is I didn't receive the mail after pressing the submit btn. Do I miss out something in th code or my format is wrong, please correct me ..............appreciated !

Could anyone help me to spot any error, cos I am new to html & asp.

You are allow to use this code for testing purpose, just cut and paste, I had cut & paste the full code at above.



regards
wong
Report
Re: HELP.......Could anyone correct me mistake.......NEED HELP Posted by ssvasan on 25 Nov 2003 at 12:06 AM
: Hi
:
: Cold someone tell me what's go wrong with this code:
:
: this file name is "form.htm"
:
:
: <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
: <html>
: <head>
: <title>Untitled Document</title>
: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
: </head>
: 
: <body>
: <form method="post" action="somescript.asp">
:   <input type="hidden" name="Postback" value="true">
:   Your Name: <input type="text" name="txtName">
:   Your E-Mail: <input type="text" name="txtEmail">
:   Your Message: <textarea name="txtMessage" rows="5" cols="80"></textarea>
:   <input type="submit" name="submit" value="Send Email">
: </form>
: </body>
: </html>
: 

: This file name is somescript.asp
:
: <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
: <html>
: <head>
: <!-- TemplateBeginEditable name="doctitle" -->
: <title>Untitled Document</title>
: <!-- TemplateEndEditable -->
: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
: <!-- TemplateBeginEditable name="head" -->
: <!-- TemplateEndEditable -->
: </head>
: 
: <body>
: <%
:   ' Check if it's a postback.  This is only really useful if you
:   ' have the form submit to itself (since you only want to send
:   ' the email when the user hits submit, not when the page first loads
:   if (Request.Form("Postback") = "true") then
:     set objEmail = Server.CreateObject("CDONTS.NewMail")
:     objEmail.To = "airwinx@yahoo.com.sg"
:     objEmail.From = Request.Form("txtEmail")
:     objEmail.Body = "Message From " & Request.Form("txtName") & ": " & Request.Form("txtMessage")
:     objEmail.Send
:     set objEmail = nothing
:   end if
: %>
: </body>
: </html>
: 

:
: My plan for this code is to let user type in some info at "form.htm" and press the submit butn, once press, it will sent the info to my email.
:
: The above sample code was provided by one of the member in programheavens. I had use this code for testing purpose. But the problem is I didn't receive the mail after pressing the submit btn. Do I miss out something in th code or my format is wrong, please correct me ..............appreciated !
:
: Could anyone help me to spot any error, cos I am new to html & asp.
:
: You are allow to use this code for testing purpose, just cut and paste, I had cut & paste the full code at above.
:
:
:
: regards
: wong
:

Hi,

I did not see any of your code, the following is a code which sends mail directly to the address specified in the action part of the form element.

<FORM action="mailto:ssvasan77@hotmail.com" method="post" enctype="text/plain">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="4" WIDTH="90%">
<TR>
<TD width="30%"><DIV align="right">
<B>Name:</B>
</DIV>
</TD>
<TD width="70%">
<INPUT type="text" name="name" size="20">
</TD>
</TR>
<TR>
<TD><DIV align="right"><B>Email:</B></DIV>
</TD>
<TD>
<INPUT type="text" name="email" size="20">
</TD>
</TR>
<TR>
<TD><DIV align="right">
<B>Comment:</B>
</DIV>
</TD>
<TD><TEXTAREA name="comment" cols="30" wrap="virtual" rows="4">
</TEXTAREA>
</TD></TR>
<TR>
<TD>&nbsp;</TD>
<TD>
<INPUT type="submit" name="submit" value="Submit">
<INPUT type="reset" name="reset" value="Reset">
</TD></TR>
</TABLE>
</FORM>



- srinivasan,


Report
Re: HELP.......Could anyone correct me mistake.......NEED HELP Posted by Manning on 25 Nov 2003 at 9:01 AM
: Hi
:
: Cold someone tell me what's go wrong with this code:
:
: this file name is "form.htm"
:
:
: <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
: <html>
: <head>
: <title>Untitled Document</title>
: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
: </head>
: 
: <body>
: <form method="post" action="somescript.asp">
:   <input type="hidden" name="Postback" value="true">
:   Your Name: <input type="text" name="txtName">
:   Your E-Mail: <input type="text" name="txtEmail">
:   Your Message: <textarea name="txtMessage" rows="5" cols="80"></textarea>
:   <input type="submit" name="submit" value="Send Email">
: </form>
: </body>
: </html>
: 

: This file name is somescript.asp
:
: <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
: <html>
: <head>
: <!-- TemplateBeginEditable name="doctitle" -->
: <title>Untitled Document</title>
: <!-- TemplateEndEditable -->
: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
: <!-- TemplateBeginEditable name="head" -->
: <!-- TemplateEndEditable -->
: </head>
: 
: <body>
: <%
:   ' Check if it's a postback.  This is only really useful if you
:   ' have the form submit to itself (since you only want to send
:   ' the email when the user hits submit, not when the page first loads
:   if (Request.Form("Postback") = "true") then
:     set objEmail = Server.CreateObject("CDONTS.NewMail")
:     objEmail.To = "airwinx@yahoo.com.sg"
:     objEmail.From = Request.Form("txtEmail")
:     objEmail.Body = "Message From " & Request.Form("txtName") & ": " & Request.Form("txtMessage")
:     objEmail.Send
:     set objEmail = nothing
:   end if
: %>
: </body>
: </html>
: 

:
: My plan for this code is to let user type in some info at "form.htm" and press the submit butn, once press, it will sent the info to my email.
:
: The above sample code was provided by one of the member in programheavens. I had use this code for testing purpose. But the problem is I didn't receive the mail after pressing the submit btn. Do I miss out something in th code or my format is wrong, please correct me ..............appreciated !
:
: Could anyone help me to spot any error, cos I am new to html & asp.
:
: You are allow to use this code for testing purpose, just cut and paste, I had cut & paste the full code at above.


What kind of error are you getting, if any? There are a couple things that might cause problems:

1) You may not have the CDONTS.NewMail object
2) The email doesn't have a subject. Maybe it'll refuse to send if one is not there. Try adding objEmail.Subject = "Test" before calling objEmail.Send

Probably other reasons but those are the two I can think if off-hand.
Report
Re: HELP.......Could anyone correct me mistake.......NEED HELP Posted by cholan on 26 Nov 2003 at 5:01 AM
Check your Mailroot Queue.. whether ur mail is added in the queue.. if it is there means... check ur SMTP service whether it is started or not...

Cholan


: : Hi
: :
: : Cold someone tell me what's go wrong with this code:
: :
: : this file name is "form.htm"
: :
: :
: : <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
: : <html>
: : <head>
: : <title>Untitled Document</title>
: : <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
: : </head>
: : 
: : <body>
: : <form method="post" action="somescript.asp">
: :   <input type="hidden" name="Postback" value="true">
: :   Your Name: <input type="text" name="txtName">
: :   Your E-Mail: <input type="text" name="txtEmail">
: :   Your Message: <textarea name="txtMessage" rows="5" cols="80"></textarea>
: :   <input type="submit" name="submit" value="Send Email">
: : </form>
: : </body>
: : </html>
: : 

: : This file name is somescript.asp
: :
: : <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
: : <html>
: : <head>
: : <!-- TemplateBeginEditable name="doctitle" -->
: : <title>Untitled Document</title>
: : <!-- TemplateEndEditable -->
: : <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
: : <!-- TemplateBeginEditable name="head" -->
: : <!-- TemplateEndEditable -->
: : </head>
: : 
: : <body>
: : <%
: :   ' Check if it's a postback.  This is only really useful if you
: :   ' have the form submit to itself (since you only want to send
: :   ' the email when the user hits submit, not when the page first loads
: :   if (Request.Form("Postback") = "true") then
: :     set objEmail = Server.CreateObject("CDONTS.NewMail")
: :     objEmail.To = "airwinx@yahoo.com.sg"
: :     objEmail.From = Request.Form("txtEmail")
: :     objEmail.Body = "Message From " & Request.Form("txtName") & ": " & Request.Form("txtMessage")
: :     objEmail.Send
: :     set objEmail = nothing
: :   end if
: : %>
: : </body>
: : </html>
: : 

: :
: : My plan for this code is to let user type in some info at "form.htm" and press the submit butn, once press, it will sent the info to my email.
: :
: : The above sample code was provided by one of the member in programheavens. I had use this code for testing purpose. But the problem is I didn't receive the mail after pressing the submit btn. Do I miss out something in th code or my format is wrong, please correct me ..............appreciated !
: :
: : Could anyone help me to spot any error, cos I am new to html & asp.
: :
: : You are allow to use this code for testing purpose, just cut and paste, I had cut & paste the full code at above.
:
:
: What kind of error are you getting, if any? There are a couple things that might cause problems:
:
: 1) You may not have the CDONTS.NewMail object
: 2) The email doesn't have a subject. Maybe it'll refuse to send if one is not there. Try adding objEmail.Subject = "Test" before calling objEmail.Send
:
: Probably other reasons but those are the two I can think if off-hand.
:




 

Recent Jobs