Forum Moderators: phranque
all of a sudden it stops sending mail to them, they say they have done no changes to any program, i cant find any thing wrong.
it use to read /usr/sbin/sendmail but looking now at there hosts setup they are saying /usr/lib/sendmail, one would say changing it to reflect the change should allow it to start working but nope.
i am at a loss
Second, temporarily change the recipient to yourself to make sure it's not something on their mail server.
How are you at coding?
It's been a long time since I worked with Matt's scripts, but one thing I remember is that he frequently used this,
(do something) or die("can't do something $!");
In this case,
open (MAIL,"¦ $mailprog -t") or die("Cannot start $mailprog $!");
In a command line, this would print the error to the screen. When called from the browser, die doesn't actually do anything useful. I've found it's better to create an error trap that actually prints something to the browser. The module Carp allows you to call (paraphrase) fatals_to_browser, but a simpler method is your own error routine:
open (MAIL,"¦ $mailprog -t") ¦¦ &error("Cannot start $mailprog $!");
.... do mail stuff
close(MAIL);
sub error {
my ($error);
$error = shift(@_);
print "Content-type: text/html\n\n";
print "An error has occurred: $error.";
exit 0;
}
The perl variable $! holds system errors, such as "no such file or directory." A simple routine like this will print all the errors back to your browser - but you have to be careful where you use it so critical system info is not fed to unscrupulous eyes.
One recommended replacement is NMS-Formmail, which is a functional equivalent (ie. you don't have to make any changes to field names etc.):
You should rename it to something other than "formmail" as there are spiders specifically seaching for this script name to use it as a spam gateway. Many hosts disactivate (change permissions) of all scripts called "formmail" for this very reason.
Make sure the script has the appropriate permissions to be able to run (chmod 701 or 755 should do it).