hamper

Well-Known Member
Apr 28, 2006
85
0
156
hello folks,

I'm having a serious issue with email forms working using the PHP ()mail function on my box. I'm not even sure when it stopped working, but it just isn't working now and I need to find out why, which is what I need help with.

I've posted a simple email form below that isn't working either. I get no errors back on the site after I submit, I cannot find any errors in any logs and there is no mails in queue on the server. I'm totally at a loss.

I'm running:
Apache version 1.3.37
PHP version 4.4.4
MySQL version 5.0.24-standard
cPanel Build 10.9.0-CURRENT 4

Code:
<div>
	<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
		<p>Name:</p>
		<input name="name" type="text" />
		<p>Email:</p>
		<input name="email" type="text" />
		<p>Subject:</p>
		<input name="subject" type="text" />
		<p>Message:</p>
		<textarea name="message" rows="6"></textarea>
		<br />
		<input type="submit" value="Send" /><input type="hidden" name="do" value="send" /><input type="reset" value="Reset" />
	</form>
</div>
<?php

if($_POST['do']=="send") {
	$recipient="[email protected]"; // Set your email here //
	$subject=$_POST['subject'];
	$name=$_POST['name'];
	$email=$_POST['email'];
	$message=$_POST['message'];
	$formsend=mail("$recipient", "$subject", "$message", "From: $name ($email)\r\nReply-to:$email");
	echo("Your message was successfully sent!");
}
?>
So any help I would very much appreciate.

hamper
 
Last edited:

hamper

Well-Known Member
Apr 28, 2006
85
0
156
thanks,

but that isn't my issue. my dns and hostname are correctly set.
i can dig, nslookup and ping it just fine and it resolves.

next?
 

rsaylor

Well-Known Member
Mar 27, 2003
160
1
168
what does /var/log/exim_mainlog state?

tail -f /var/log/exim_mainlog

Try sending an email, what error do you get? Have you also tried re-compiling php?
 

hamper

Well-Known Member
Apr 28, 2006
85
0
156
Hi,

Well the register_globals were turned off so I turned them on and restarted apache and still no difference in getting mail from a form script.

as to the other question..

Code:
[email protected] [/home/clancy]# tail -f /var/log/exim_mainlog
2006-09-15 07:20:04 1GOBjn-0007Nk-Li => username <[email protected]> R=virtual_user T=virtual_userdelivery
2006-09-15 07:20:04 1GOBjn-0007Nk-Li Completed
2006-09-15 08:02:44 Start queue run: pid=1985
2006-09-15 08:02:44 End queue run: pid=1985
2006-09-15 09:02:44 Start queue run: pid=10611
2006-09-15 09:02:44 End queue run: pid=10611
2006-09-15 10:02:44 Start queue run: pid=19343
2006-09-15 10:02:44 End queue run: pid=19343
2006-09-15 11:02:44 Start queue run: pid=27979
2006-09-15 11:02:44 End queue run: pid=27979
I've changed certain points, but this is what the output was.
It seems everything ran and finished fine.

I'm just really confused as to what the problem is. Anyone?
 

gflamerich

Well-Known Member
Jul 21, 2003
122
0
166
Register globals hasn't anything to do with your problem,
you are not using register globals ($_SERVER['PHP_SELF'], $_POST['do'], etc.. )
I recomend you to turn it back to off, because in furute php releases register globals will be totally removed.

On the other hand.
As far I can see, you don't have phpsuexec, if so, mails are sent by nobody. So go to:
WHM ->Tweak Settings where you can find:

Prevent the user "nobody" from sending out mail to remote addresses (PHP and CGI scripts generally run as nobody if you are not using PHPSuexec and Suexec respectively.)

If that box is checked, thats the reason of why emails are not being delivered.
 

Anishts

Active Member
Oct 6, 2005
37
0
156
Hi

hello,

try that script in shell prompt and see what it is saying....

# php scriptname.php and also tail the mail log same time in a different shelll
 

hamper

Well-Known Member
Apr 28, 2006
85
0
156
Hi,

where would I check to see if I am running phpsuexec?

I checked the logs again, and nothing again.

I checked the settings and no the box wasn't checked.

I'm really at a loss here. Thinking about it, I tried to
setup and run the postwwwacct script and I cannot get
an email back from it either.

Could it be something with my firewall?

Thanks again.. anything else you can think of.
 

hamper

Well-Known Member
Apr 28, 2006
85
0
156
PROBLEM FIXED

I followed the suggestion of:

deleted the /etc/eximmailtrap file
changed /var/cpanel/cpanel.config to make eximmailtrap=0

and this solved the problem.

thanks to everyone for your suggestions.

now I'm off to try to install PHP5 :)