This content has been marked as final. Show 19 replies
> I am somewhat new to this all, and i have a question. If i create a form for
> my website with dreamweaver and users fill that form out and then click
> how do i receive the contents of that form? any help would be appreciated.
What does your hosting's FAQ/Support section say about form scripts?
Does your hosting have a "control panel" or CPanel? Look There.
If no pre-installed script, What scripting method can you use on this
A php script:
A Perl/cgi script:
A free dreamweaver extension that will make a form script for
The best advice and something you'll be able to use over and over again is that before asking any questions, you do a quick search in this forum. You'll see that this question gets asked and answered several times a day - dozens of time a week.
okay, i checked my control panel with my host and there is a section called CGI-Wizard, with the option of "FormMail". What does this mean? How do i set this up with my dreamweaver created forms? thanks.
and when you click on the formmail link in the control panel....
does it take you to a page of info/instructions?
give a path to use for the action of the form?
> okay, i checked my control panel with my host and there is a section called
> CGI-Wizard, with the option of "FormMail". What does this mean? How do i set
> this up with my dreamweaver created forms? thanks.
This is what it brings up when i click on FormMail. "FormMail
Documentation. (this is a link)
About (this is a link)
FormMail is a generic WWW form to e-mail gateway, which will parse the results of any form and send them to the specified user. This script has many formatting and operational options, most of which can be specified through the form, meaning you don't need any programming knowledge or multiple scripts for multiple forms. This also makes FormMail the perfect system-wide solution for allowing users form-based user feedback capabilities without the risks of allowing freedom of CGI access. There are several downloading options available below and more information on this script can be found in the Readme file.
Example of how to use Formmail: HTML, (this is a link) Source (this is a link)
and??? Have you clicked on those FOUR links and READ the information on how
to use the script?????
Yes, this is what i've found on how to install the script, it is all a foreign language to me, would my host be able to walk me through the set up process?
Setting Up the FormMail Script
The FormMail.pl script does not have to be extensively configured in order to work. There are only two variables in the perl file which you will need to define along with changing the top line of your script to match the location of you Perl interpreter.
$mailprog = '/usr/lib/sendmail -i -t';
This variable must define the location to your server's sendmail program. If this is incorrect, form results will not be mailed to you. Specifying the parameters in this variable is new in v1.91, and we have included the -i parameter so that a single period on a line by itself will not end the message. -t instructs sendmail to read the recipient list from the message text.
@referers = ('scriptarchive.com','YOUR_IP');
This array allows you to define the domains on which you allow forms to reside and use this installation of FormMail. If a user tries to put a form on another server, that is not scriptarchive.com, they will receive an error message when someone tries to fill out their form. By placing scriptarchive.com in the @referers array, this also allows www.scriptarchive.com, ftp.scriptarchive.com, any other http address with scriptarchive.com in it and scriptarchive.com's IP address to access this script as well, so no users will be turned away.
NOTE: This is not a security check. Referer headers can EASILY be faked. Rather, it prevents someone on xyznotyou.com from using the FormMail on your server to process forms on their server on a regular basis. It remains in the script as a remnant of earlier versions when it was used for security, but the @recipients variable is now used to specify exactly who can receive e-mail from this installation.
As of version 1.7, the domains listed here are also used as the defaults when checking valid recipient e-mail addresses. You should either include all domain names that you wish to have FormMail send e-mails to in your @referers array or tailor the @recipients array by hand.
@valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER', 'HTTP_USER_AGENT');
This array allows the administrator to specify a list of environment variables that the user may request be added into the e-mail. This is a security patch that was advised at http://www.securityfocus.com/bid/1187 and was implemented by Peter D. Thompson Yezek at http://www.securityfocus.com/archive/1/62033.
Only environment variables listed in this array may be included in the form field env_report. So if you wanted to also know what URL a user was submitting from, you could change @valid_ENV to:
@valid_ENV = ('REMOTE_HOST','REMOTE_ADDR','REMOTE_USER',
and then include HTTP_REFERER in your env_report form field.
@recipients = &fill_recipients(@referers);
If you wish to only allow e-mail addresses at the domain names in @referers to receive form results, you probably do not need to change this variable. However, if you get any 'Error: Bad/No Recipient' messages when running FormMail, you may have to revisit @recipients and make sure you have correctly listed all domains or configured this variable.
@recipients is the most important variable you need to configure. It is an array of regular expressions defining all valid recipients that can be specified. In order for an e-mail to be sent to the recipient defined in a form, the recipient e-mail address must match one of the elements in the @recipients array.
For the most simple setup, place any domain name that you wish to send form results to in the @referers array. Warning: This allows those domains to also access your FormMail script and utilize it to process their own forms, but likely this is what you intended anyway. If so, you can leave:
@recipients = &fill_recipients(@referers);
NO, THAT IS NOT WHAT I INTENDED!
Another alternative, then, is to set @recipients equal to the return value of the fill-recipients function and pass this function all of the domains to which e-mail may be addressed:
@recipients = &fill_recipients('domain.com',
You are now allowing e-mail to any username (provided it contains only A-Z, a-z, 0-9, _, - or .) at those three domains.
Similarly, since @recipients is just an array, you could even do:
@recipients = (&fill_recipients('domain.com','sub.domain.com'),
This would allow any recipient at domain.com and sub.domain.com similar to the previous example, but would also allow your friends otheruser1 and otheruser2 on otherhost.com to use your FormMail! Of course, you will need to add otherhost.com into your @referers array if a form is on their host!
HOW DOES THAT WORK?
When the fill_recipients function is called on an array of domain names, it turns them into regular expressions. These regular expressions will only allow e-mail messages to go to a recipient with an e-mail address in the following format:
where domain.com is specified in @referers. For any IP addresses in @referers, the following address formats are valid:
where 192.168.1.1 is the specified IP address in @referers.
What this means in english is that the only valid addresses are those to usernames that include only letters, numbers, underscores, dashes or periods and an exact domain name or IP address that was specified in the @referers array. Depending on your needs, this may be too broad or not broad enough.
WHAT IF YOU NEED MORE FLEXIBILITY??
The way FormMail validates a recipient address is to check the supplied recipient(s) in the submitted form against each element in the array @recipients (which is a list of Perl regular expressions). If any valid recipients are found, they will receive a copy of the message.
Using the examples of @referers = ('domain.com','192.168.1.1'); and the default usage of setting @recipients = &fill_recipients(@referers), the contents of @recipients are now the same as if you had written:
@recipients = ('^[\w\-\.]+\@domain\.com',
What these regular expressions instruct FormMail to do is require that any e-mail address passed in as a recipient of the form submission match at least one of those two formats. The following are examples of valid and invalid recipients for this exact setup:
Last-First@[192.168.1.1], firstname.lastname@example.org, etc.
INVALID: (using these in your form field 'recipient' will trigger error)
Essentially, it only allows A-Z, a-z, 0-9, _, - and . in the local address area (before the @, represented as [\w\-\.]+ in regular expression speak) and requires the domain name to match exactly. When mailing to an IP address, it must be enclosed in .
BUT I NEED TO MATCH MORE CHARACTERS IN THE USERNAME!
Let's say you need to be able to deliver e-mail to an address like: last:email@example.com
This requires that the ':' character now be allowed into the portion of the recipient field before the domain name. You could then modify @recipients to read:
@recipients = ('^[\w\-\.\:]+\@domain\.com');
BUT BE CAREFUL!!!!
Allowing certain characters could be VERY dangerous, especially if the characters are: %, <, >, (, ) or any newlines. You can read: http://web.nps.navy.mil/~miller/percent-hack.html
for information on exactly why the % character could be dangerous. And the document that prompted 1.91 explains why some of the others could lead to problems: http://www.monkeys.com/anti-spam/formmail-advisory.pdf
I ONLY WANT CERTAIN ADDRESSES TO WORK!
Let's say you only want firstname.lastname@example.org to be able to receive any form submissions. You should then set the @recipients array to:
@recipients = ('^yourself\@yourdomain\.com');
Now the only valid recipient is that one e-mail address.
If there are several, simply do:
@recipients = ('^user1\@yourdomain\.com',
CAN I USE SOMETHING EASIER?
Prior versions of FormMail recommended settings for @recipients like:
@recipients = ('domain.com','192.168.1.1'); OR
@recipients = ('^email@example.com');
The first is bad because it can be easily tricked by submitting a recipient such as firstname.lastname@example.org. The second is MUCH better, but since it is used as a regular expression, and '.' can mean ANY character, a could use joe@somewhereelseXcom to get past a valid recipient check. This is not a very big deal in most cases.
WHAT IS THIS ^ CHARACTER AND WHY SO MANY \'s??
In regular expressions, the ^ means "beginning of string". By default, FormMail places a $ at the end of the match, which means "end of string". By using both ^ and $ in regular expression matching, FormMail can match a string exactly. You only need to worry about including the ^, which is STRONGLY recommended for all regular expressions in the array.
The \ character is used to escape a character that otherwise means something special in regular expressions. For instance, you now see every '.' being escaped with a '\', as '.' means ANY CHARACTER, whereas '\.' requires that it match ONLY a period.
If you need a regular expression matching solution even more specific than the above examples explain, I recommend picking up a book on Perl.
Your formmail program is now configured.
click the link with the example form, and look at it's source.
I'm guessing that the script is already INSTALLED, and you set the form's
action to something similar to
/cgi-sys/formmail.pl for example.
and you put the required field of "recipient" into your form...
> Yes, this is what i've found on how to install the script, it is all a foreign
> language to me, would my host be able to walk me through the set up process?
Your host put those FAQ/Instructions there for their customers use. It's
doubtful they will explain what the instructions mean.
stepping back a few posts--
Does your hosting support PHP?
(my guess is it does, if you have a cpanel with a formmail clone set up)
then the simplest thing to do is get the kaosmailer extension i linked to
earlier. http://kaosweaver.com -->extensions-->list all-->kaosmailer
alright, i've downloaded that extension and installed it for dreamweaver... now what? what does that do for me? i really appreciate your time helping me. thanks.
Read The Fine Help the author provided.
also, there is probably a Help button when you open it.
Can't find how to open an extension?
Open the Extension Manager. Select the extension from the list, and the
author's notes show and usually say WHERE in the dw menus to find the
> alright, i've downloaded that extension and installed it for dreamweaver...
> now what? what does that do for me? i really appreciate your time helping me.
i've created a mock form and also configured the exension manager the best that i could. I then saved the file and uploaded it to my server, then tried to call the file in my browser, and then clicked the submit button on the form, this is the error that i get... "Method Not Allowed
The requested method POST is not allowed for the URL /Untitled-1.html.
Apache/1.3.31 Server at lewisqic.com Port 80"
do NOT use Layout View to make a form. Use Regular view.
There are 7 sets of <form> tags on that form page.
there should be only ONE set- the first opening <form> tag and the last
</form> tag. ALL of the form elements must be within that one set of form
http://lewisqic.com/kwmailer.php is 404 not found.
> The requested method POST is not allowed for the URL /Untitled-1.html.
> Apache/1.3.31 Server at lewisqic.com Port 80"
okay, i've managed to learn a few things. I have created an html form with dreamweaver and then used the kaosmailer command. It creates a php file when i use the extension. I then uploaded both the test html form and the kwmailer.php file to my server. I then called the file www.lewisqic.com/Untitled-4.html in my browser and then filled in the form. This is where i get lost. It does allow me to fill in the form and it also redirects me to the address that i specified, but i am not getting any email that shows the results of the submitted form. any help?
copy the code, and paste into reply.
> It does allow me to fill in the form and it also
> redirects me to the address that i specified, but i am not getting any email
> that shows the results of the submitted form. any help?
mail("email@example.com","html form", "email field=".$_POST['email field']." \ntextfield=".$_POST['textfield']." \ncheckbox=".$_POST['checkbox']." \ncheckbox2=".$_POST['checkbox2']." \n","From:".$_POST['email field']);
header ("location: http://www.lewisqic.com");
have you checked the Junk or Spam folder at that hotmail address?
yes, there is nothing. have i done everything correctly so far?
On Tue, 24 Oct 2006 17:10:07 +0000 (UTC), "lewisqic"
> mail("firstname.lastname@example.org","html form", "email field=".$_POST['email
>field']." \ntextfield=".$_POST['textfield']." \ncheckbox=".$_POST['checkbox']."
>\ncheckbox2=".$_POST['checkbox2']." \n","From:".$_POST['email field']);
> header ("location: http://www.lewisqic.com");
Spaces are not allowed in name or id attributes. Change the name in your
form and in the script above from "email field" to "email_field".
You should also be aware that the above script is completely open to
abuse by spammers. You may want to Google "email injection".