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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie with ASP form

Status
Not open for further replies.

danielh68

Technical User
Jul 31, 2001
431
US
Hi,

I'm trying to build a form for our company site and I'm not having much success. The particular server our site sits on is Windows based and does have ASPmail components. I even found some info on the site pertaining to ASPmail at .

Anyhow, I have created two pages: myform.asp & email-action.asp. You may view this at . It's not much know. I wanted a simple form first and if it works, I can elaborate later.

Currently, if I type info into the input fields and submit it, I do receive an emial. However, I don't receive any user input. I really don't know what I'm doing wrong. Here's the code for both pages.

myform.asp:

<html>
<head>
<title>Untitled Document</title>
<body>
<FORM METHOD=&quot;POST&quot; ACTION=&quot;email-action.asp&quot; name=&quot;Info&quot;>
Your Name: <INPUT TYPE=&quot;TEXT&quot; NAME=&quot;Mailer.FromName&quot;><BR>
Your Address: <INPUT TYPE=&quot;TEXT&quot; NAME=&quot;Mailer.FromAddress&quot;><BR>
Subject: <INPUT TYPE=&quot;TEXT&quot; NAME=&quot;Mailer.Subject&quot;><BR>
Message: <INPUT TYPE=&quot;TEXT&quot; NAME=&quot;Mailer.RemoteHost&quot;><BR>
<BR>
<INPUT TYPE=&quot;SUBMIT&quot; VALUE=&quot;Send mail&quot;>
</FORM>
</body>
</html>

email-action.asp:

<%
Set Mailer = Server.CreateObject (&quot;SMTPsvg.Mailer&quot;)
Mailer.FromName = &quot;Optistreams&quot;
Mailer.FromAddress = &quot;danielopti@hotmail.com&quot;
Mailer.Subject = &quot;Your Widget Order&quot;
Mailer.Subject = &quot;New Contact&quot;
Mailer.RemoteHost = &quot;mail-fwd.verio-web.com&quot;

Mailer.AddRecipient &quot;Dan&quot;, &quot;danielh68@sierratel.com&quot;

if Mailer.SendMail then
' Message sent sucessfully
response.write (&quot;Your message was sent&quot;)
else
' Message send failure
response.write (&quot;Your message was not sent. &quot;)
response.write (&quot;The error was: &quot; & Mailer.Response)
end if
%>


A much advanced thanks to anyone who can provide help.

Best Regards,
DanH
 
You need to change the second Mailer.Subject to Mailer.BodyText like this :

Code:
<% 
    Set Mailer = Server.CreateObject (&quot;SMTPsvg.Mailer&quot;) 
    Mailer.FromName = &quot;Optistreams&quot; 
    Mailer.FromAddress = &quot;danielopti@hotmail.com&quot; 
    Mailer.Subject = &quot;Your Widget Order&quot; 
    Mailer.
Code:
BodyText
Code:
 = &quot;New Contact&quot; 
    Mailer.RemoteHost = &quot;mail-fwd.verio-web.com&quot;  

    Mailer.AddRecipient &quot;Dan&quot;, &quot;danielh68@sierratel.com&quot;  

    If Mailer.SendMail Then 
        ' Message sent sucessfully 
        response.write (&quot;Your message was sent&quot;)       
    Else 
        ' Message send failure 
        response.write (&quot;Your message was not sent. &quot;) 
        response.write (&quot;The error was: &quot; & Mailer.Response) 
    End If 
%>
Regards

Big Bad Dave

logo.gif


davidbyng@hotmail.com
 
Also if you want to collect information from a form you need to use Request.Form() like so :

Code:
<% 
    Set Mailer = Server.CreateObject (&quot;SMTPsvg.Mailer&quot;)
    Mailer.FromName = Request.Form(&quot;Mailer.FromName&quot;)
    Mailer.FromAddress = Request.Form(&quot;Mailer.FromAddress&quot;)
    Mailer.Subject = Request.Form(&quot;Mailer.Subject&quot;)
    Mailer.BodyText = Request.Form(&quot;Mailer.BodyText&quot;)
    Mailer.RemoteHost = &quot;mail-fwd.verio-web.com&quot;

    Mailer.AddRecipient &quot;Dan&quot;, &quot;danielh68@sierratel.com&quot;

    If Mailer.SendMail Then
        ' Message sent sucessfully
        response.write (&quot;Your message was sent&quot;)
    Else
        ' Message send failure
        response.write (&quot;Your message was not sent. &quot;)
        response.write (&quot;The error was: &quot; & Mailer.Response)
    End If
%>
Regards

Big Bad Dave

logo.gif


davidbyng@hotmail.com
 
Thanks everyone. I added BodyText and this:

Set Mailer = Server.CreateObject (&quot;SMTPsvg.Mailer&quot;)
Mailer.FromName = Request.Form(&quot;Mailer.FromName&quot;)
Mailer.FromAddress = Request.Form(&quot;Mailer.FromAddress&quot;)
Mailer.Subject = Request.Form(&quot;Mailer.Subject&quot;)
Mailer.BodyText = Request.Form(&quot;Mailer.BodyText&quot;)
Mailer.RemoteHost = &quot;mail-fwd.verio-web.com&quot;

Mailer.AddRecipient &quot;Dan&quot;, &quot;danielh68@sierratel.com&quot;

Yet, I still receive empty emails. The code makes perfect sense. The request is to grab info from the item in the form name FromName, etc. However, it doesn't follow the instruction. I must missing something. Any thoughts? Thanks.

DanH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top