Operating System - Linux
1748066 Members
5276 Online
108758 Solutions
New Discussion юеВ

Re: Sending Email under PHP

 
Ng King Wang
Respected Contributor

Sending Email under PHP

Hello all,

I am using PHP 4.2.2 on Linux 8.0.

I would like to send email by using PHP, but I fail to do it. My colleague confirms that all eequired PHP modules are loaded.

What configuration should I need to do for solving this problem?

Thanks.
We master OpenView, my Lord masters us.
7 REPLIES 7
Jerome Henry
Honored Contributor

Re: Sending Email under PHP

Hi,

What do your logs report ?
You should have something like this in your PHP code :
...
$recipient="foo@yahoo.com";
$title="trial";
$message="hello world";
mail($recipient,$title,$message);
echo "done);
?>

You can test it replacing last line by :
if (mail($recipient,$title,$message)))echo "ok, done";
else echo "problem on sending";

then post your log error messag for analysis.

hth

J
You can lean only on what resists you...
Ng King Wang
Respected Contributor

Re: Sending Email under PHP

Thanks for your reply.

Which log file should I post?

Thanks again.
We master OpenView, my Lord masters us.
Jerome Henry
Honored Contributor

Re: Sending Email under PHP

Hi,

depending on your machine, httpd.log if you set one up, or the part of /var/log/messages corresponding to the time of your sending trial.

J
You can lean only on what resists you...
Huc_1
Honored Contributor

Re: Sending Email under PHP

I suppose the answer to the log question would be the part concerning your php mini script test

probably in

/var/log/http/paccess.log
or
/var/log/http/error.log

Jerome, will correct me if I am wrong !

J-P (Bonsoir, Jerome)
Smile I will feel the difference
Jerome Henry
Honored Contributor

Re: Sending Email under PHP

Salut JP (hi JP !) !
Exactly, especailly error file, but this of course if you set up logging on your httpd server.
If you don't see anything, then /var/log/messages will do.

J (not on weed end watching tv, JP ?)
You can lean only on what resists you...
Ng King Wang
Respected Contributor

Re: Sending Email under PHP

Thank you for all your replies.

I attach "messages" file for error checking. Please help.

By the way, my colleague has a problem as below: (Please help him also.)

I have a virtal hosting server by named base method.
I found that I cannot use mail() function when using PHP4 even I set correctly in php.ini and sendmail to open smtp and set the sever has relay permission. But still fail to use mail() function. I found from other forums mention about some settings in "httpd.conf" regarding "php_admin_value". Also it mentions this function can be overrided by .htaccess and virtual host, what does it mean? And how can I solve the mail() problem of PHP
php-4.2.2-8.0.5
httpd-2.0.40-8
sendmail-8.12.5-7
We master OpenView, my Lord masters us.
Ng King Wang
Respected Contributor

Re: Sending Email under PHP

Hello,

Attached file is the error log.

Thanks again.
We master OpenView, my Lord masters us.