Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail() function not working at all

Status
Not open for further replies.

georgeocrawford

Technical User
Aug 12, 2002
111
GB
Hi,

I'm setting up php on a friends computer. He's running OS X 10.2.6 Server.

We've got php set up, and it seems to do everything except the mail function.

Code:
<?php
$email = mail(&quot;me@hotmail.com&quot;, &quot;hello&quot;, &quot;hello&quot;);
echo ($email ? &quot;yes&quot; : &quot;no&quot;);
?>

The above script hangs for about 15 seconds, then prints &quot;no&quot;.

There was NOT a php.ini file in the original installation of PHP. I have added one to the directory /usr/lib/php, which is a direct copy of
Restarted Apache, same result.

I then changed the following:

Code:
; For Unix only.  You may supply arguments as well (default: &quot;sendmail -t -i&quot;).
;sendmail_path =

to
Code:
; For Unix only.  You may supply arguments as well (default: &quot;sendmail -t -i&quot;).
sendmail_path = /usr/sbin/sendmail

... but this changed nothing. I believe this was the default path anyway.

Can someone please help.

I have no experience using OS X Server. I don't know if sendmail automatically runs, or if it needs to be started, or what the path to it actually is. I got thie path above from the Apple Help document on sendmail

Many thanks!

______________________

George
 
mail() functions is basically a windows oriented function, it needs SMTP, use the sendmail() function...

Known is handfull, Unknown is worldfull
 
make sure that the apache config file has the same email as the email that sending on the php file..

example: apache has johnp@yourdomain.com then the php script has to read:
mail(&quot;johnp@yourdomain.com&quot;, &quot;subject&quot;, &quot;message&quot;);

also keep in mind that the email that it is sending from must be your server, it can not be a hotmail account because it has no way of connecting to the server and telling hotmail to send mail out...

hope this helps
Max

Nothing is hard when you realy want to learn it.

Max
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top