Web Hosting Talk







View Full Version : Perl Formmail Problems


atomaka
02-12-2003, 05:01 PM
Hello. I am having problems with a formmail script I am using. The script works perfectly fine most of the time, but sometimes, it won't send the emails. The emails it refuses to send to seem to be pretty consistent by domain. I am using the following code:

open(DETAILS,'|/usr/sbin/sendmail -t')or $Core::fnc->general_error('Could not send details email');
print DETAILS "To: $email\n";
print DETAILS "From: Andrew Tomaka ($Core::admin_email)\n";
print DETAILS "Subject: Your ######## Registration!\n\n";
print DETAILS "Congratulations on signing up. You may now proceed to the login screen and log in with the following details:\n";
print DETAILS " Username: $username\n";
print DETAILS " Password: $password\n";
print DETAILS "Welcome Aboard!\n";
close(DETAILS);

I just find it weird that it works on some emails and not all, leading me to believe it is some server setting or something, but I need to know if there is a way to fix it.

Thanks for your time!

~ Andrew Tomaka

luxline
02-13-2003, 06:53 AM
Have you looked in the server logs - that will usually tell you why the email isnt being sent.

Also, for the emails that fail, have you tried to actually send mail from your server using mail or similar? There you will get a direct error if the destination address refuses a connection etc.

Change the From: to something very basic instead of using ::admin_email. Hard code it, eg
From: fred\@domain-name.com
FOR TESTING OF COURSE! - maybe theres a small bug in the admin_email function//global vars etc?

And, in your formmail, ALWAYS put the email sending routine LAST. Dont put it before the html output. Maybe your hoster upgraded sendmail or changed the sendmail.cf and you are not aware of it.

Let me know how you get on with that lot, hope it helps in some way.

atomaka
02-14-2003, 08:07 AM
Hey man! Thanks for the response.

I actually had it running with a hard coded email address before the global var was put in place and the same thing was still resulting. I'll try and look at the logs when I get home today and will report back with what I can find out.

Thanks for the suggestions!

~ Andrew Tomaka