Click to See Complete Forum and Search --> : Formmail problem


mickapoo
06-11-2004, 03:05 PM
I am a total newbie, so please bear with me :)

My form is located at http://www.desconnection.com/jny2004orderformASP.html

When I submit, I get an error message that says I have not specified a recipient. However, if you view the source, you will see that I have:
<form action="scripts/formmail.asp" method="POST">
<input type="hidden" name="recipient" value="shelley@desconnection.com">

Then in my formmail.asp file I have:
'- Customization of these values is required, see documentation. -----
referers = Array("www.desconnection.com", "desconnection.com")
mailComp = "CDONTS"
smtpServer = "smtp-relay.mindspring.com"
fromAddr = "guest@desconnection.com"
'- End required customization section.

Can anyone advise me as to what I am doing wrong? I keep going over it, but I can't figure it out. Thank you.

lmf232s
06-11-2004, 03:40 PM
post the code with the CDONTS code, The problem could be their. Also show you validation.
From viewing the source, it looks good but can we see the asp or what ever you are using to do the email.


Also are you hardcoding the recipient, subject, and email into the ihidden text boxes. If so why not just hard code them into the CDONTS section of the code, if these three will always be the same.

mickapoo
06-11-2004, 05:11 PM
It's not allowing me to paste in that much text. I have attached the file for the page that the form resides on.

I got this script from Brainjar.com.

mickapoo
06-11-2004, 05:12 PM
And here is the code for the formmail.asp file (I had to change the extension). Sorry I could not paste it, it was too large and would not allow it.

lmf232s
06-11-2004, 05:41 PM
I think this might be the problem.
You have your recipient field on the first form.
After you click the submit order button you are
redirected to the formmail.asp page.
From this page you are trying to do a request.form("_recipients")
But this form has no reference to this variable because it is contained in the formmail.asp page.

You could do a couple of things. Pass the _recipients field through the query string and accept it on the formmail.asp page.
example
<form action="scripts/formmail.asp?recipient=<%request.form("_recipient")%> method=Post>

or you could put all the code on one page.
Put your logic in the top of the form and you html at the bottom.
When you submit, submit to the same page, it will do its validation. If an error occurs you could redirect and display the message and if it is a success you could redirect to another page and display the message.

I think but not sure, that you are trying to request a variable that is not associated with the second page. their for it is empty when you request it and it errors out.

Let me know what you think.

mickapoo
06-11-2004, 06:02 PM
I just caught it... it was as simple as adding an "s" to recipient.
Stupid, stupid, stupid!!! Thanks anyway for all of your help.

lmf232s
06-14-2004, 09:16 AM
Just a little tip. If you would of put
<%option explicit%> as the very first thing on both of your forms, it would of caught that error for you a long time ago.
I have noticed that alot of people do not use option explicit but it will save you hours of debugging time.

It will make you declare all your variables and if a varible is not declared it will error out and tell you. This would of helped in your case where you left off an S. It would of errored out on you.

Later.