Click to See Complete Forum and Search --> : email form problems, any ideas??


shel38
04-24-2009, 07:17 AM
im new to ASP so tbh i dont really have a clue whats going on. here is my html code:<form method="POST" action="contactus.aspx">
<fieldset class="list">
<p1> Name: <input type="text" name="Name" size="30"/> <br /><br />
Subject: <input type="text" name="Subject" size="50"/> <br /><br />
<p1>E-mail Address: <input type="text" name="E-mail Address" size="50"> <br /><br />
<p1>Tel:<input type="text" name="Tel" size="30"> <br /><br />

Comments:<br /> <textarea name="Comments" rows="10" cols="50" wrap="physical" >
</textarea><br /><br />
Please specify what category your comment falls into:




<br /><br /><label for="topic1">
<input id="topic1" name="subject" class="noBorder" value="Brand or product" type="radio">
Service you experience whilst at Lloyds Lanes<br />
</label>

<label for="topic2">
<input id="topic2" name="subject" class="noBorder" value="Investor relations" type="radio">
Question about our party packages we offer<br />
</label>

<label for="topic3">
<input id="topic3" name="subject" class="noBorder" value="Environment &amp; society " type="radio">
Other <br />
</label>



<br /> <input name="submit" value="Submit" type="submit" />
<input value="Clear" type="reset" />
</p1></form>

and here is what ive got in my .aspx page <%

' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim Comments

' get posted data into variables
EmailFrom = Trim(Request.Form("EmailFrom"))
EmailTo = "lloydslanes@googlemail.com"
Subject = Trim(Request.Form("Subject"))
Name = Trim(Request.Form("Name"))
E(-mail Address = Trim(Request.Form("E-mail Address")))
Tel = Trim(Request.Form("Tel"))
Comments = Trim(Request.Form("Comments"))

' validation
Dim validationOK
validationOK=true
If (Trim(EmailFrom)="") Then validationOK=false
If (validationOK = False) Then Response.Redirect("error.htm" & EmailFrom)

' prepare email body text
Dim Comments
Comments = Comments & "Comments: " & Comments & vbCrLf

' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = Name
mail.Subject = Subject
mail.Comments = Comments
mail.Send

' redirect to success page
Response.Redirect("emailsent.htm" & EmailFrom)
%>


please help! I am very confused! Thanks!

Kuriyama
04-24-2009, 08:00 AM
what type of error are you getting? I see that you are using CDONTS as your mailing object. CDONTS is very old and not support out of the box by windows 2003 Server and beyond. You might want to look at CDO.message as your mailing object.

shel38
04-24-2009, 08:04 AM
this is the error message i am getting:

The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


A name was started with an invalid character. Error processing resource 'file:///C:/Users/Shel/Documents/Uni Work/Year 2/We...

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="contactus.aspx.vb" Inherits="_Default" %>
-^

oh ok for the mailing object shall i litterally just change my ("CDONTS.NewMail") for ("CDO.message")?? sorry, but i really dont know asp at all, this is my first time using it lol.

Kuriyama
04-24-2009, 08:15 AM
.aspx files are related to .NET. You might want to ask this question in the .NET forums. I'm not sure anyone will be able to help you here.