Wise Women List Archive File

Configuring Matt's FormMail Script

[Editor's Note: FormMail is a free CGI script used to email form entries; there have been some issues with security, so for best results, use the version at http://sourceforge.net/projects/mattfm/]


I'm using my first form with FormMail, configured through my admin panel. This is a big step for me! However, I have run into what seems an odd problem. Here's the form that uses the formmail.pl script


It works just great in IE5, reporting to the log and everything. But when I try to submit using NN 4.77, I get this error:

"The form attempting to use FormMail resides at
http://www.project-aware.org/contact.html, which is not allowed to
access this cgi script.

If you are attempting to configure FormMail to run with this form,
you need to add the following to @referers in file
Add 'www.project' to your @referers array."

Well, it's already in there...unless I'm supposed to also put partial referer urls??

Or is it just a Netscape thing? I sure hope not, because there are plenty of site visitors who use it.

Thanks for you help. I hate feeling so dumb about something that appears to be simple. ... sigh...


The formmail script has a feature that allows the Web designer to say which domains are allowed to send mail through the script. This is to prevent other people from using your script to send spam. They could have a form on their own site, on another domain, link to your script to send the mail.

If you open the formmail script in a text editor, you can edit it. You only need to make a few changes toward the top, and the instructions for doing so are right there next to the lines that you have to change. On one line, you will be asked to list the domain names that have permission to use your script to send email. You can add your domain name (usually both with and without the "www") and then save the script and upload again. Always upload a CGI script in ASCII mode. Then, your problem should be solved.

You'll also need to check and see if you have a formmail.cfg file (should have come with the script), if so make sure you add the domain names to that as well. I usually add the domain with www and without and the IP number just to be sure.

You'll see a line in the formmail.pl file that says:
require 'formmail.cfg';

That will tell you that you need the formmail.cfg file. If you don't have it your should be able to get it where you got the script, or email me and I'll send you one.

Good Luck!

I discovered that if I removed the enctype="text/plain" from the form tag, then the formmail.pl worked and allowed processing in Netscape 4.x

I'm ecstatic!!! Hope that will also allow IE 6 users to succeed posting comments.

Does anybody know whether this workaround is dangerous or not advisable? What does enctyp mean, anyway?

enctype tells the browser what type of data is being collected by the form so it can encode it properly before sending it to the server. AFAIK there are just two types in use: "application/x-www-form-urlencoded" and "multipart/form-data". The first type is used for ordinary text data. It is the default value when a form doesn't actually specify an enctype. The enctype "multipart/form-data" is used when a form is uploading files. Files require special encoding and also need to be kept separate from other form data.

So for ordinary forms, you're not doing anything dangerous or wrong if you simply leave off enctype.

BTW, "text/plain" is a MIME type used by servers to tell browsers what type of data to expect. It's not appropriate in a form. Apparently Netscape and IE browsers were handling the incorrect enctype differently - no surprise there.