View Full Version : Formmail error

09-24-2003, 02:58 PM
Trying to set up formmail.pl on my page.

I get back a "500 Internal Error" from the site ("...internal error...misconfiguration...etc...contact sysadmin...") I can't seem to find out what causes it.
The apache error_log tells me that the script return malformed headers, and the resultant email is dumped into /dead.letter.

So, there are no syntax errors in the script, no calling errors, or missing fields. But the email is dumped and no valid HTML is returned.

Anyone have an idea of whats up???

09-25-2003, 08:38 AM
I was working on one users script problem and found that it was missing.

print "Content-type: text/html\n\n";

It was giveing the "malformed headers" error. I also remember reading in the forum at some point that others had problems using formmail.pl and that WestHost was now using a diffrent version. I will try and hunt down those threads/post.


09-25-2003, 08:46 AM
I did find this post about it. Did a search and lots came up but this seemed to be the most relevant. http://forums.westhost.com/phpBB2/viewtopic.php?p=5073

Are you trying to install it through the Site Manager?

09-25-2003, 12:00 PM
formmail was installed by Site Manager... and works fine, if for instance, I forget to provide an email address, then it will shout back for an email address. So, the script is fine and functional.
I've also got the same script working on other sites and I've compared the installation and everything seems hunky-dory.

So, as an experiment I installed NMS-formmail, which is a simple plug-in (and a very nice piece of code!) and that throws back the error that there is a problem with the sendmail installation. Which ties in with the fact that the old formmail would handle the HTML side OK, but not the mail sending.

But, debugging a sendmail installation, thats gonna be drag.


09-28-2003, 09:29 AM
From my reading nms-formail is not really a plug-in. It is an enhanced version of formail 6. nms org is always slightly behind because they don't write programs,they just enhance them, mostly from a security aspect.

Matt's Formmail and sendmail have both been upgraded to plug security holes. I don't know what versions Westhost is supplying. The latest version from sendmail.org is Sendmail 8.12.10, and Matts formail is version 1.92. There may be compatibility problems with nms formail. Debuging sendmail sounds time consuming. formail 1.92 and sendmail 8.12.10 seem to work well together. Of neither of them will encrypt the form data, so the largest security hole is still there.


09-28-2003, 11:43 AM
Matt Wright's site was advising everybody to use his latest formmail 1.92 and ditch earlier versions. It should work well and plug security holes.

I run into the frustrating 'malformed header' error from time to time. The error log is little help. As WJD noted, there were earlier postings on this topic and maybe they will help.

Generally, I only had the problem when customizing a script. Any subroutine creating its own page also has to produce the print "Content-type: text/html\n\n"; line, else you wipe it out when the page refreshes.

The opposite problem is printing "Content-type: text/html\n\n"; on the HTML output, where your code path has caused the script to generate the content-type line twice. Here at least you can SEE what is wrong!

09-28-2003, 03:18 PM
Johnie, Alex, thanks for the input.

Westhost supply formmail 1.92, so that is uptodate. The nice thing about NMSformmail is that you can configure it to debug, which tells you which part of the script is throwing an error, Matts formmail is a little tricky in this regard, as it gives no indication of what part has failed.

But, both scripts will run frm the shell without errors, and they compare identically with scripts that I have running on other Westhost sites, so the only thing I can think of is that when NMSformmail says there was an error executing sendmail, then that is the problem. More on this when I have time to debug it. Maybe tomorrow night.