trouble sending email from PHP

tincboy

Verified User
Joined
Aug 14, 2009
Messages
126
I've create a test.php which simply calls mail function of php
While I run this file via ssh with command of "php -q test.php" it sends the mail but run the php file with url and browser makes no sense,

Any help will be much apperciated.
 
What does your apache log file say? It was probably denied for some reason. Since you can override some php directives via the httpd.conf it is not 100% equal to doing "php -q test.php" from the command line.
 
If you used the IP address to access apache, then it would be in the log files located in /var/log/httpd those should not be empty.
 
If you used the IP address to access apache, then it would be in the log files located in /var/log/httpd those should not be empty.

No I'm using domain to run the php script via browser, in /var/log/httpd access_log is empty but error_log contains logs which is not related to that php script
 
If you used a domain to access that script, then there 100% should be a log of you accessing that script either in the access_log or one of the $DOMAINNAME.log files. Are you sure you are hitting your server with the browser and not a different server?
 
Unfortunatly the logs all are empty, Also I've checked the server and it's the same server
 
Unless you changed something in the main httpd.conf file, it should be logging something (GET or POST requests) for every access to the web server. None of those logs should be empty. Without the logs, there is nothing else to go off of to help. Short of logging in a seeing why it isn't working it is too difficult diagnose without them.
 
I've recompiled the PHP and it's now generating logs per domain,

It's the related error log entry:

[Tue Nov 29 09:15:58 2011] [error] [client ip] 2011-11-29 09:15:58 cwd=/home/username/domains/mydomain.com/public_html 3 args: /usr/sbin/sendmail -t -i
 
There should be more related to that in the /var/log/exim/mainlog. It looks like sendmail was called (and I assume it really is located in /usr/sbin). Now you need to see why exim didn't deliver the email.
 
Unfortunatly there's nothing related to that email entry in maillog of exim, ( no log entry for that specific time ) :(
 
How about giving us a lot more details on you system/install. Is this a new box? Which OS are you using? How exactly did you do the install, did you follow the instructions exactly? Did you modify anything the install or skip any steps?

On a default clean install of Directadmin, Apache/Php/exim should all log everything. Since yours is not, I am thinking that something was skipped or not installed right in the first place, and that makes it very hard to figure out your problem. The more details you give, the better me or anyone else reading this thread can understand the root of your problems and can help.
 
How about giving us a lot more details on you system/install. Is this a new box? Which OS are you using? How exactly did you do the install, did you follow the instructions exactly? Did you modify anything the install or skip any steps?

On a default clean install of Directadmin, Apache/Php/exim should all log everything. Since yours is not, I am thinking that something was skipped or not installed right in the first place, and that makes it very hard to figure out your problem. The more details you give, the better me or anyone else reading this thread can understand the root of your problems and can help.

This is not a new box, and it was working greate before I've recompiled php to enable soap.
I can send email via "php -q test.php" but calling test.php via browser will cause no email sending.
Except PHP which is version 5.3.8 every other software is the same as directadmin installed.

thanks all
 
Back
Top