Forum Moderators: coopster

Message Too Old, No Replies

mail() function does not work

mail() function

         

chrislinzh

4:18 pm on Mar 18, 2005 (gmt 0)

10+ Year Member



I use mail() function to send an email. But it doesn't work.Is there any problem with the server or my code?
<?
if (mail("user@example.com","This is the test mail","Here is the testing text")) { print("ok");}
else print "fail";
?>
the result is "fail".

Please help me out of this problem.

[edited by: coopster at 5:29 pm (utc) on Mar. 18, 2005]
[edit reason] generalized email [/edit]

jatar_k

10:09 pm on Mar 18, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld chrislinzh,

well it could be a long list of things, you get fail in the code so I am guessing the mail doesnt get sent.

what OS are you running this on?
do you actually have an smtp server on this machine?
is php properly configured to send mail?

chrislinzh

6:42 pm on Mar 20, 2005 (gmt 0)

10+ Year Member



Yes,the mail didn't send.
The OS is UNIX,it is a web hosting server.SO I think it should have a SMTP server.