visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: PHP :: PHP mail()/sendmail Problem


By: P_Daoud U.S.A.  Date: 11/10/2004 00:00:00  English  Points: 125 Status: Answered
Quality : Excellent
Hi,

I have a simple problem that I can’t solve.

I'm trying to send email message using the mail() function in PHP, but with no luck. I don't get any errors, but at the same time nothing is sent.

I have PHP 4.3.1 on Redhat Linux 8.0 and Apache 2.0 running. I have the following parameters set sendmail_path = '/usr/sbin/sendmail -t'

I'm just using a simple mail() command.

<?php
$send = mail('pdaoud@yahoo.com','test','just testing');
echo $send;
?>

When I run this file from a command line as any user ( php sendmail.php) everything works fine, but when I try to run it from the browser nothing happens.

Any ideas?

By: VGR Date: 11/10/2004 00:08:00 English  Type : Comment
don't you need at least to specify a "From: anything@yourSMTPdomain" in the headers ? (fourth parameter, missing above)
By: carchitect Date: 11/10/2004 00:29:00 English  Type : Comment
no VGR that is not necessary
well problem is somewhere else
By: carchitect Date: 11/10/2004 00:32:00 English  Type : Comment
does it send mail when you run it thru command
By: run_faster Date: 11/10/2004 02:48:00 English  Type : Comment
Does $send tell you that the email was in fact, sent? Or no? If it says its sent, and you're not getting the emails, I would check the sendmail queue, mailq is the command I believe. Most of the time, the sendmail configuration seems to be the problem.
By: lokeshv Date: 11/10/2004 06:54:00 English  Type : Comment
check log of sendmail ..

Lk
By: P_Daoud Date: 11/10/2004 14:56:00 English  Type : Comment
Yes, when I run it from the command line the messages is sent and $send = 1. But from the browser no message is sent and $send="".

It seems that it has to do with rights ... running the php sendmail.php from the command line workes for any user but from the browser (apache user) it doesn't work...
By: VGR Date: 11/10/2004 15:51:00 English  Type : Answer
I bet apache is running as nobody/nobody ?

does this user have access to the sendmail executable's directory ? :D
By: swarnajyothirmayi Date: 12/10/2004 05:02:00 English  Type : Comment
Follow this url maybe it will be helpful

<A HREF="http://www.webmasterworld.com/forum13/1820.htm">http://www.webmasterworld.com/forum13/1820.htm</A>
By: zoobie Date: 15/10/2004 09:23:00 English  Type : Comment
If this is a free host, the mail() function is undoubtly disabled.
By: eight17 Date: 15/10/2004 10:32:00 English  Type : Comment
Are you getting other errors displayed? If not, edit your php.ini or use phpinfo() and take a look at your display_errors setting. If you have it set to Off, then errors will not be printed to the browser. You may have this turned off to avoid seing errors which aren't really errors (I'm tempted on occasion), but it IS on by default.

Do register to be able to answer

EContact
browser fav
page generated in 314.193960 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page