Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - CDONTS - help required, please!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CDONTS - help required, please!

 Post Reply Post Reply
Author
madHatter View Drop Down
Newbie
Newbie
Avatar

Joined: 23 January 2003
Location: United Kingdom
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote madHatter Quote  Post ReplyReply Direct Link To This Post Topic: CDONTS - help required, please!
    Posted: 13 February 2003 at 2:02pm

Hello

I am writing in the hope somebody can assist me with some code. I don't think it is too complicated, but I have had no luck with it.

I have two ASP pages, one with a form (ASP1) on it, and one which is a 'Thank you' page (ASP2).

On ASP1, I have a script which personalises ASP2 (as in 'Thank you John') and which also checks that all form fields have been completed:

<%
If Request.Form.Count > 0 Then
    Name  = Trim(Request.Form("t1"))
    Email     = Trim(Request.Form("t2"))
    Message  = Request.Form("S1")

session("t1") = request.form("t1")
  
   
    'data validation
    If Name = "" Then
        ErrorMsg = ErrorMsg & "Please enter your name<br>"
    End If
    If Email = "" Then
        ErrorMsg = ErrorMsg & "Please enter your email address<br>"
    End If
    If Message = "" Then
        ErrorMsg = ErrorMsg & "Please write your message<br>"
    End If
  

    If ErrorMsg = "" Then
        'use this to perform any database validations
       
        'when the name, email and message fields have been checked, redirect the visitor
        Response.Redirect "welcome1.asp"
    End If
End If
%>

<form action="<%= Request.ServerVariables("SCRIPT_NAME") %>" method=post>

<% If ErrorMsg <> "" Then %>
    <p><font color="#FFFFFF"><b><%= ErrorMsg %></b></font><p>

<% End If %>

The form fields concerned are as follows:

<input type=text name=t1 value="<%= t1 %>">
<input type=text name=t2 value="<%= t2 %>">
<textarea name=S1 value="<%= S1 %>"></textarea>

On ASP2, I have:

<p>Thank you <%= session("t1") %></p>

which is the script which personalises the page.

Also on ASP2, and unrelated to the above script, I have the following CDONTS code:

<%
Dim t1name,t1,t2name,t2
t1name = "name"
t1 = Request.Form("t1")
t2name = "email"
t2 = Request.Form("t2")
Dim stname,st
stname = "comments"
st = Request.Form("s1")
Dim ObjMail
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.To = "me1@aol.com"
ObjMail.CC = t2
ObjMail.From = t2
ObjMail.Subject = "Feedback"
ObjMail.Body = t1name & vbcrlf&_
t1 & vbcrlf&_
t2name & vbcrlf&_
t2 & vbcrlf&_
stname & vbcrlf&_
st
ObjMail.Send
Set ObjMail = Nothing
%>

My message to this forum conerns this: the CDONTS code should send an email to the Webmaster and a copy to the person who filled in the form. It doesn't work, and I can't understand why, though I suspect it is something to do with the variables.

If anybody can help, I would be grateful (and please forgive the names which I have given to the variables).

Best wishes

madHatter

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2003 at 3:12pm
When you say it does not work; what do you mean? Do you get an error message, does the mail not get send?? Some more detail would help troubleshooting your problem.
Back to Top
madHatter View Drop Down
Newbie
Newbie
Avatar

Joined: 23 January 2003
Location: United Kingdom
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote madHatter Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2003 at 3:49pm

Hello Michael

Many thanks for your message.

The CDONTS does work as a script - that is, there is nothing wrong with its logic - at least, nothing that I know of. I have tested it elsewhere, and it does send out a message to the Webmaster and a copy to the person who completed the form.

But no, on the site above (please see my first posting), it doesn't work. That is, it doesn't actually send any messages out. I have the CDONTS set up so that I am both the Webmaster (an email should go to the Webmaster's email address) and the site visitor (a different email box that I use) and.........nothing! No messages received.

I suspect the problem lies with the variable t1 or "t1" or <%t1%> or something like that, because as I mention, the CDONTS script itself runs fine elsewhere.

Thanks for your help, I'm grateful.

madHatter

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2003 at 5:21pm
Well the logic itself seems fine though I am not using CDONTS so might be wrong. A problem that I encounter on some server though is that mail is just rejected as either they must be sent to a mailbox of the same domain or the recipient server has the originater listed as a spam server so does not allow it. A lot of mail servers that are used by many users in a hosting environment are abused so get listed pretty quick.
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2003 at 9:21pm
its time to rule out (1) your code or (2) improper CDONTS setup..

run a little test script first, see if you get the mail, then report back

super simple test script
Contribute to the working anarchy we fondly call the Internet
Back to Top
madHatter View Drop Down
Newbie
Newbie
Avatar

Joined: 23 January 2003
Location: United Kingdom
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote madHatter Quote  Post ReplyReply Direct Link To This Post Posted: 14 February 2003 at 1:38am

Hello MorningZ

Many thanks for your message.

The script is now working fine.

There was nothing wrong with the CDONTS code, but I had it placed on the 'Thank you' page and not the form page. I did this because I thought the variables used behind the form were related to the CDONTS script - which they weren't until I transferred the CDONTS from one asp file to another.

Many thanks to both of you on this forum for all your time, suggestions, and efforts. I'm grateful again.

Best wishes

madHatter 

 

Back to Top
jkeck View Drop Down
Newbie
Newbie


Joined: 05 August 2003
Location: United States
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote jkeck Quote  Post ReplyReply Direct Link To This Post Posted: 05 August 2003 at 9:53pm

As someone just learning ASP the above dialogue has been very helpfull, thanks.

Now My question is this: I have created a similar form using the same validation technique. However I find it a bit unhelpfull that when the error messages are returned that the form is wiped clean and the user must re-enter all the fields.

Is there a way to retain the fields that passed the validation check so the user can simply finish the form and re-submit it?

Thanks

Josh

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.